Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -602,12 +602,17 @@ var spawn = exports.spawn = function(file, args, options) { | |
args: args, | ||
cwd: options ? options.cwd : null, | ||
windowsVerbatimArguments: !!(options && options.windowsVerbatimArguments), | ||
detached: !!(options && options.detached), | ||
envPairs: envPairs, | ||
stdio: options ? options.stdio : null, | ||
uid: options ? options.uid : null, | ||
gid: options ? options.gid : null | ||
}); | ||
|
||
if (options && options.detached) { | ||
child.unref(); | ||
This comment has been minimized.
Sorry, something went wrong.
AndreasMadsen
Member
|
||
} | ||
|
||
return child; | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
setInterval(function () {}, 500); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright Joyent, Inc. and other Node contributors. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to permit | ||
// persons to whom the Software is furnished to do so, subject to the | ||
// following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
var common = require('../common'); | ||
var assert = require('assert'); | ||
var path = require('path'); | ||
|
||
var spawn = require('child_process').spawn; | ||
var childPath = path.join(__dirname, '..', 'fixtures', 'child-process-persistent.js'); | ||
|
||
var child = spawn(process.execPath, [ childPath ], { | ||
detached: true, | ||
stdio: 'ignore' | ||
}); | ||
|
||
process.on('exit', function () { | ||
process.kill(child.pid); | ||
assert.throws(process.kill(child.pid), Error); | ||
}); | ||
|
3 comments
on commit 4b021a3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the 'ignore' option to stdio, input stream? Would it be better to use null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'null'
or 'undefined'
are default values for stdio
option, that means that for stdio < 3 (i.e. stdin, stdout, stderr) it'll create 'pipe'
and for others 'ignore'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shtylman - The new stdio
API for child processes allows for a couple of shorthands - if you pass only the string ignore
, all three stdio
will be redirected to /dev/null
, or the windows equivalent. Where this test is concerned, it was used for simplicity.
running in the background after the parent exits is the correct reading?