Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server keeps running in background after closing or stopping command. #8786

Closed
KCENZO opened this issue Feb 8, 2024 · 0 comments · Fixed by #8792
Closed

Server keeps running in background after closing or stopping command. #8786

KCENZO opened this issue Feb 8, 2024 · 0 comments · Fixed by #8792
Assignees
Labels
bug Something isn't working bun.js Something to do with a Bun-specific API

Comments

@KCENZO
Copy link

KCENZO commented Feb 8, 2024

What version of Bun is running?

1.0.26

What platform is your computer?

Linux - Ubuntu

What steps can reproduce the bug?

First of all, I apologize for my bad English.

Before I was using version 1.0.26, the server would close itself when I closed the command prompt or stopped it, but after updating the version, the server is still running.

I'm using watch mode, and this happens after the first save.

The example file:

server.ts

import { Hono } from 'hono'

const app = new Hono()

app.get('/', () => {
    
    return Response.json({ message: 'Hello, World!' })
})

const server = Bun.serve({
    fetch: app.fetch,
    port: process.env.PORT || 5000
})

console.log(`Server is running in ${server.url.href} address.`)

and the command:

bun --watch server.ts

and the error message after the first save:

5 | app.get('/', () => {
 6 | 
 7 |     return Response.json({ message: 'Hello, World!' })
 8 | })
 9 | 
10 | const server = Bun.serve({
                    ^
EADDRINUSE: Failed to start server. Is port 5000 in use?
 syscall: "listen"

and after the error message I have to find for process PID and kill it.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@KCENZO KCENZO added the bug Something isn't working label Feb 8, 2024
@gvilums gvilums self-assigned this Feb 8, 2024
@Electroid Electroid added the bun.js Something to do with a Bun-specific API label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun.js Something to do with a Bun-specific API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants