-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Exiting terminal while running npm
in a pane does not terminate processes from terminal
#15373
Comments
This issue seems very similar to #541 |
This issue is still reproducible for me on preview version 1.17.1023 |
Repro steps from #15708
|
I think it's important to highlight that this only seems to occur with npm projects. The process will actually stop either if I run the script directly with |
npm
in a pane does not terminate processes from terminal
Another repro:
|
If I run npm in a PS command, I observe this same behavior: If I run npm in a PS job, the background job is terminated correctly when I close the pane/tab/window |
Same here with the PS command. I was debugging a ps1 script and noticed that each time I run it the port number increments. Then I had to go to the task manager and manually kill 20+ node processes... .__. This is weird. |
Why is this bug not getting more attention? It makes the terminal completely useless for anything other than very specific toy projects and people unaware of the bug will get their system resources slowly eaten up until things start failing. |
This bug is kind of scary, to be honest. I started a project and then when I thought the server was closed it was still running (after 7h that I first closed the terminal). I checked everything and found nothing. But then the last shot was looking into the Process Explorer and bang: node.js still running initialized by command line npm start. |
Hey can anyone check if this still repros on 1.22 Preview/? We did some improvements to the way we generate CTRL_CLOSE events over the last couple of releases, and we're pretty confident we're doing it right now. Thanks! |
I am still experiencing this issue on the 1.22 preview (specifically v1.22.2362.0). In my case I am running a local server for a Angular website. The development server will persist after the terminal is exited. |
This is still happening on preview version 1.22.2702.0. To replicate just run // index.js
import express from 'express';
const app = express();
const port = 3000;
app.get('/', (req, res) => { res.send('Hello World'); });
app.listen(port, () => { console.log(`Server is running at http://localhost:${port}`); }); Then close the terminal and the server will still be running. |
Temporary solution for Windows: taskkill /IM "node.exe" /F Mac and Linux: #!/bin/bash
pkill -f "node" |
Windows Terminal version
1.16.10261.0
Windows build number
10.0.19045.0
Other Software
Node.js v16.14.2
Steps to reproduce
npm run start
to run a local website with React)x
button on the windows terminal window to exit windows terminalExpected Behavior
When quitting windows terminal, background processes should be stopped. The local server running the React website should also be terminated when windows terminal exits.
Actual Behavior
Background process continues running indefinitely. Task manager does not indicate any windows terminal tasks running in the background. The background task appears to be buried and is difficult to discover so the easiest way to terminate the process is to restart the machine. Restarting the machine terminates the background process and website is no longer hosted.
The text was updated successfully, but these errors were encountered: