Skip to content

exec('nohup node some.js &') #426

@sarbbottam

Description

@sarbbottam

Not sure if its a bug rather question.

  • node - 5.10.0
  • shelljs - ^0.6.0
  • os - OS X 10.11.4

Can I do something like:

// index.js
require('shelljs/global');
const path = require('path');
const target = path.join(process.cwd(), process.argv[2])
exec('nohup node ./watcher.js ' + target + '&');
// watcher.js
const fs = require('fs');

function watch(dir) {
  fs.watch(dir, (event, filename) => {
    if (filename) {
      // do something
    }
  });
}

watch(process.argv[2]);
node src/index.js ./test/fixtures

I expect the index.js to terminate and on ps -ef | grep watcher to find the process corresponding to watcher.js listed

In practice it doesn't. Is it by design?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions