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

Script being kept alive #4

Open
oscar-broman opened this issue May 22, 2013 · 1 comment
Open

Script being kept alive #4

oscar-broman opened this issue May 22, 2013 · 1 comment

Comments

@oscar-broman
Copy link

The script doesn't exit automatically like it should when waitpid has been used. Commenting out the line that waits causes the script to run for 1 second then quit, as expected. With waitpid, however, the script just keeps running.

var waitpid = require('waitpid');
var childProcess = require('child_process');

var child = childProcess.spawn('sh', ['-c', 'sleep 1']);

console.log('waiting..');
waitpid(child.pid);
console.log('done waiting');

Tested with Node.js v0.10.4 on OS X and v0.10.7 on Debian 6.

@oscar-broman
Copy link
Author

One way to fix this is changing the following line:

r = waitpid(child, &status, WNOHANG);

to this:

r = waitpid(child, &status, 0);

I'm not sure, though, what other features that breaks.

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

1 participant