-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
A shell is spawning every time we spawn a child process on Windows #7653
Comments
See https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_child_process_spawn_command_args_options -- make sure the Let me know if it is |
As you can see here, and as the documentation tell |
When you say 'spawns a shell', do you mean it opens a console window? |
@bnoordhuis Yes |
Right. That's a property of the executable you are spawning and not something node.js has direct control over. Closing, not a bug. |
@bnoordhuis We are spawning the node executable by default like you can see here when spawning an app, same behavior happening here, but no console window popup with npm here. |
You aren't running npm with |
It's a flag in the PE header of the .exe that controls whether a console window is opened or not. IOW, whether an application is a console application or not is something that is decided at compile time. You can suppress it up to a point by passing |
We are using childProcess.fork(). I find it hard to believe people aren't having major problems with this. The pm2 behavior does not mimic the node behavior. Trying to push a production app onto a windows device is no longer possible with pm2 as continual popups are not an option. Whether it is a bug or not is inconsequential. The point is: there has to be a way around this problem. |
@wayofthefuture did you ever find a solution to your issue? I seem to have the same problem. Straight running the app using "node app.js" works but running the app in pm2 spawns consoles. |
Yup! Here's the solution: https://github.com/kohsuke/winsw I ran into problems with pm2 in both linux and windows. So now I use systemd and winsw and no longer use pm2, just straight up node myapp.js using a service... not to mention the permission problems and startup problems involved with cross-platform implementation of pm2. |
Looks like someone has opened a new issue (#15217) and a solution has been found, just need to implement it |
When spawning a child process with ``require('child_process').spawn`, a shell spawn for few milliseconds (almost one seconds) on Windows.
pm2's users are reporting us this issue (here or here) , which come from this code that we are using to spawn the user app.
Just asking why it is spawning and if we can prevent them to spawn ?
Thanks !
The text was updated successfully, but these errors were encountered: