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

[Feature Request] Add a quit (repl) command #2158

Closed
EldTM opened this issue Jan 17, 2024 · 7 comments
Closed

[Feature Request] Add a quit (repl) command #2158

EldTM opened this issue Jan 17, 2024 · 7 comments
Labels
has work around 💪 stale no activity for 2 weeks

Comments

@EldTM
Copy link

EldTM commented Jan 17, 2024

  • nodemon -v: 3.0.3
  • node -v: v21.6.0
  • Operating system/terminal environment: Windows 11 Pro / cmd.exe / wt.exe (Windows Terminal) / powershell.exe/pwsh.exe (Power Shell)
  • Using Docker? What image:
  • Command you ran:
    package.json: "scripts": { "start": "nodemon ./bin/www" }
    npm start

Expected behaviour

Typing in 'q', 'quit', or possibly 'x' or 'exit' on the terminal (repl) (similar to the 'rs' command) could allow graceful exit of the guest app and also nodemon itself, taking any cleanup code/hooks into consideration as well.

Actual behaviour

Currently, there doesn't seem to be a good clean way to gracefully quit, especially on Windows. I'm already aware of the possibility of CTRL + C, but it has certain limitations, including when npm start/nodemon is invoked from a batch script.

P.S. Always appreciate your work remy :-)
Thank you.


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

Copy link

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

@github-actions github-actions bot added the stale no activity for 2 weeks label Jan 31, 2024
@EldTM
Copy link
Author

EldTM commented Jan 31, 2024

@remy ^Bump

@github-actions github-actions bot removed the stale no activity for 2 weeks label Jan 31, 2024
@remy
Copy link
Owner

remy commented Feb 1, 2024

This has been raised before, and inline with the design principle of fewer features, it's been agreed that it wouldn't be added.

Perhaps if you can elaborate on "I'm already aware of the possibility of CTRL + C, but it has certain limitations" - what limitations are they?

My understanding is ctrl+c is send a kill signal and thusly the chain of processes should shutdown. Certainly nodemon isn't doing anything more than that in the code, sending a kill signal to the subprocess. Adding a "exit"/"q" key would do the exact same thing…

@remy remy added has work around 💪 not a bug / external to nodemon An issue that is outside of nodemon and removed not a bug / external to nodemon An issue that is outside of nodemon labels Feb 1, 2024
@EldTM
Copy link
Author

EldTM commented Feb 1, 2024

My idea was the possibility of a shutdown/cleanup hook function on the one hand that if possible could be made to be more graceful in shutting down the processes and/or doing additional cleanup work.

The other, main concern was that there were suggestions that the nodemon can spawn multiple instances while restarting due to lack of proper cleanup (graceful shutdown) on Windows. I expect CTRL+C is more effective on linux/nix. If you're sure that CTRL+C properly cleans up everything and doesn't leave a zombie nodemon after itself, then I have no more concerns regarding that part of my rationale.

@remy
Copy link
Owner

remy commented Feb 1, 2024

It's not quite that simple. What's happening when you send ctrl+c, is that nodemon is trapping the signal then doing a controlled shutdown of the spawned process, then trying to work out if it actually shut down, and then nodemon exits itself.

So you see, adding support for an arbitrary command to shut down is no different to ctrl+c, and the result is the same. Zombies will occur, sometimes, but it depends entirely on the system and the software.

I hope that clarifies a bit.

Copy link

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

@github-actions github-actions bot added the stale no activity for 2 weeks label Feb 15, 2024
Copy link

Automatically closing this issue due to lack of activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has work around 💪 stale no activity for 2 weeks
Projects
None yet
Development

No branches or pull requests

2 participants