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

Restart via 'rs', even without changes to watched files #1159

Closed
Tjomas opened this issue Dec 13, 2017 · 3 comments
Closed

Restart via 'rs', even without changes to watched files #1159

Tjomas opened this issue Dec 13, 2017 · 3 comments

Comments

@Tjomas
Copy link

Tjomas commented Dec 13, 2017

  • nodemon -v: 1.12.5
  • node -v: v8.9.1
  • Command you ran: nodemon --legacy-watch --on-change-only --verbose < $pipeNodemon &amp; pid=$!

Nodemon runs inside a docker container.
There are unwatched file extensions that another process creates. When all the files are completely written, i want to send a manual signal through a pipe. However, this has no effect, since the restart is not executed because no changes are detected.
A restart should be a restart no matter if there are any changes.

With or without "--on-change-only" makes no difference.

entrypoint.sh:
mkfifo $pipeNodemon
nodemon --legacy-watch --on-change-only --verbose < $pipeNodemon &amp; pid=$!

// At some point later
echo -e "rs\r\n" > $pipeNodemon

Config

{
"ext": "json hbs trigger",
"delay": "300",
"watch": [
"dist"
],
"exec": "node --inspect=0.0.0.0:9229 ./dist/server.js",
"ignore": [
"src/**/*.spec.ts"
]
}

Expected behaviour

A real restart.

Actual behaviour

A change detection without a restart.

backend-api_1 | [TSC] 13:48:52 - File change detected. Starting incremental compilation...
backend-api_1 | [TSC] 13:48:52 - Compilation complete. Watching for file changes.
backend-api_1 | [TSC] 13:48:52 - Trigger nodemon // this is the: echo -e "rs\r\n" > $pipeNodemon
backend-api_1 | [nodemon] files triggering change check: dist/modules/database/product/product.entity.js
backend-api_1 | [nodemon] matched rule: /app/dist//*
backend-api_1 | [nodemon] changes after filters (before/after): 1/0

Steps to reproduce

  1. Remove .js from the watched extensions.
  2. Touch some js file
  3. Send rs

Thank you for any advice.

@remy
Copy link
Owner

remy commented Dec 13, 2017

I'm pretty sluggish when it comes to working with Docker, so do you think you could pull together a simple script that you can run instead of nodemon that will echo out the stdin that you're intending to inject? That way we can rule out that node isn't the problem.

nodemon reads stdin like this:

      process.stdin.resume();
      process.stdin.setEncoding('utf8');
      process.stdin.on('data', function (data) {
        data = (data + '').trim().toLowerCase();
        console.log(data); // nodemon would _do_ something with data
      });

@remy
Copy link
Owner

remy commented Dec 15, 2017

I'm not 100% sure you want to pipe to stdin, but with [email protected] you can send a SIGHUP to nodemon and it trigger a restart. I'm going to close as I believe this is a workaround that I think you're after. Happy to reopen if not.

@remy remy closed this as completed Dec 15, 2017
@Tjomas
Copy link
Author

Tjomas commented Dec 18, 2017

Thank you. Works perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants