remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.23k stars 1.72k forks source link

Advice, not a bug. #2214

Open Digital-Pig-LLC opened 1 month ago

Digital-Pig-LLC commented 1 month ago

Let me preface this with, logically this should work, and if I need to really dig into it I will, I'm just looking for some advice on where to start. I have a node app running in a Debian 12 container, on Windows (should make no odds). My app dev env is IntelliJIDEA. When I save new code, nodemon is not restarting, and I understand why. So, what I came up with is this: On save, execute a "docker exec" command, which send a shell command to call a shell script. The shell script is as follows:

PID=`ps aux | grep nodemon | grep -v grep | awk '{print $2}' | tail -n 1
echo -e "rs\n" > /proc/$PID/fd/0

The idea is simply...get the PID of nodemon, send input to it Given this nodemon output:

npm start

> article-repo-lister@1.0.0 start
> nodemon -e js,twig -x ./bin/www app.js

[nodemon] 3.1.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,twig
[nodemon] starting `./bin/www app.js`

...after running the script, I simply see a new line, like so: `rs

` So, the rs + newline is being sent to the process, but is not seen by nodemon.

I know, I'm probably cray-cray, I just love following thoughts like this even if I don't end up using it. I guess I need to know how is the input received when I simply use the keyboard as opposed to using the script.

Thanks! Sorry for the lengthy explanation.

Expected behaviour

nodemon restarts

Actual behaviour

no change

Steps to reproduce

The above contains everything.


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

Digital-Pig-LLC commented 1 month ago

Is it really nodemon that receives the "rs" input, or is it node? Hmmm!

github-actions[bot] commented 1 month ago

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

ankhzet commented 1 month ago

@Digital-Pig-LLC just do something like touch .nodemon, where .nodemon is added to the the watched extensions list and git-ignored. As a result, nodemon would detect changes and restart.

Digital-Pig-LLC commented 1 month ago

Thanks @ankhzet I'll give that a try.

github-actions[bot] commented 2 weeks ago

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