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

Advice, not a bug. #2214

Open
Digital-Pig-LLC opened this issue Jul 26, 2024 · 5 comments
Open

Advice, not a bug. #2214

Digital-Pig-LLC opened this issue Jul 26, 2024 · 5 comments
Labels
stale no activity for 2 weeks

Comments

@Digital-Pig-LLC
Copy link

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.

  • nodemon -v: 3.1.4
  • node -v: 22.5.1
  • Operating system/terminal environment: Debian 12 Bash
  • Using Docker? What image: Yes, node:latest
  • Command you ran: nodemon -e js,twig -x ./bin/www app.js

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
Copy link
Author

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

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 Aug 10, 2024
@ankhzet
Copy link

ankhzet commented Aug 12, 2024

@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.

@github-actions github-actions bot removed the stale no activity for 2 weeks label Aug 12, 2024
@Digital-Pig-LLC
Copy link
Author

Thanks @ankhzet I'll give that a try.

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 Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity for 2 weeks
2 participants