Created
May 16, 2010 01:02
-
-
Save kieran/402552 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var startServ = function (restart) { | |
passArgs = restart ? args.concat('-Q', 'true') : args; | |
child = spawn('node', args); | |
//.......... | |
sys.puts(sys.inspect(child.pid)) // ** reports pid properly | |
}; | |
var restartServ = function (oldStat, newStat) { | |
// atime changes when the app loads | |
if (oldStat.mtime != newStat.mtime) { | |
sys.puts(sys.inspect(child.pid)) // ** NULL - should be pid | |
process.kill(child.pid); // throws Error (below) | |
startServ(true); | |
} | |
}; | |
/* | |
Error: Bad argument. | |
at StatWatcher.<anonymous> (/Users/kieran/.node_libraries/geddy-core/scripts/startserv.js:56:13) | |
at node.js:187:9 | |
*/ | |
// sys.inspect(child) reports pid as [Getter] - is this a nodejs function?: | |
/* | |
{ _internal: { onexit: [Function], pid: null } // <--------------- | |
, stdin: | |
{ fd: null | |
, secure: false | |
, _readWatcher: null | |
, readable: false | |
, _writeQueue: [] | |
, _writeQueueEncoding: [] | |
, _writeWatcher: null | |
, writable: false | |
} | |
, stdout: | |
{ fd: null | |
, secure: false | |
, onend: [Function] | |
, _readWatcher: null | |
, readable: false | |
, _writeQueue: [] | |
, _writeQueueEncoding: [] | |
, _writeWatcher: null | |
, writable: false | |
, _events: { data: [Function] } | |
} | |
, stderr: | |
{ fd: null | |
, secure: false | |
, onend: [Function] | |
, _readWatcher: null | |
, readable: false | |
, _writeQueue: [] | |
, _writeQueueEncoding: [] | |
, _writeWatcher: null | |
, writable: false | |
, _events: { data: [Function] } | |
} | |
, pid: [Getter] // <--------------- | |
, _events: { exit: [Function] } | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment