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

--on-change-only / -C seemingly does nothing #1742

ejulen opened this issue Jul 23, 2020 · 6 comments · May be fixed by TheDogenode/torrent-aio-bot#4

--on-change-only / -C seemingly does nothing #1742

ejulen opened this issue Jul 23, 2020 · 6 comments · May be fixed by TheDogenode/torrent-aio-bot#4


Copy link

@ejulen ejulen commented Jul 23, 2020

  • nodemon -v: 2.0.4
  • node -v: v12.17.0
  • Operating system/terminal environment: Ubuntu 20.04
  • Command you ran: nodemon -C some-script.js

Expected behaviour

some-script.js not being executed on startup. Please correct me if this is a misunderstanding on my part!

Actual behaviour

some-script.js is executed on startup.

Steps to reproduce

  1. Install nodemon.
  2. Create any sort of script, for example something that simply logs "Hello!" to the console.
  3. Run nodemon -C script-name-here.js.

[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
node: v12.17.0
nodemon: 2.0.4
command: /home/johannes/.local/bin/node /home/johannes/dev/project/node_modules/nodemon/bin/nodemon.js -C --dump some-script.js
cwd: /home/johannes/dev/project
OS: linux x64
  run: false,
  system: { cwd: '/home/johannes/dev/project' },
  required: false,
  dirs: [ '/home/johannes/dev/project' ],
  timeout: 1000,
  options: {
    runOnChangeOnly: true,
    dump: true,
    ignore: [
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    watch: [ '*.*', re: /.*\..*/ ],
    monitor: [
    ignoreRoot: [
    restartable: 'rs',
    colours: true,
    execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' },
    stdin: true,
    verbose: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: 'some-script.js',
      exec: 'node',
      args: [],
      scriptPosition: 0,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'js,mjs,json',
      env: {}
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: { executable: 'node', args: [ 'some-script.js' ] },
    string: 'node some-script.js'
@remy remy added the bug label Jul 23, 2020
Copy link

@remy remy commented Jul 23, 2020

Yep, confirmed. Some regression somewhere...

Copy link

@MonarchChakri MonarchChakri commented Aug 3, 2020

Found the root cause of the issue.
Will be submitting a Pull Request (#1751) with the fix.

Also it was not caught by the tests because the test was never actually executed under test/monitor/run.test.js.


Copy link

@luizverissimo luizverissimo commented Aug 3, 2020

I tought that it is a bug on ubuntu 20.04, I tried run forever and pm2 too, but both doesn't restart server after edit files.

Copy link

@MonarchChakri MonarchChakri commented Aug 5, 2020

Did you get time to have a look at my PR (#1751): fix for this bug?

MonarchChakri added a commit to MonarchChakri/nodemon that referenced this issue Aug 7, 2020
Moved run.kill outside the run function
Moved up restart bind, before runCmd so that we can use it in run.kill

If command is not to be run the we just need to watch files and not fork/spawn a child process

Binding options with instance of run, so that we can use it in run.kill (
Updated run options inside if condition (
Copy link

@stale stale bot commented Aug 22, 2020

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

@stale stale bot added the stale label Aug 22, 2020
@stale stale bot closed this Aug 29, 2020
Copy link

@MonarchChakri MonarchChakri commented Oct 4, 2020

Commenting to reopen the issue

remy pushed a commit that referenced this issue Oct 4, 2020
Fxies issue #1742: corrected run.js, run.test.js, watch.js for the use case runOnChangeOnly=true (#1751)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants