doc: correct check for failed child_process.spawn

Since 0.10.x, exec failures are no longer signaled through stderr,
but rather as error events.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
pull/41362/head
Adrian Lang 2013-08-14 21:31:33 +02:00 committed by Fedor Indutny
parent d3204b0225
commit 044da47353
1 changed files with 2 additions and 5 deletions

View File

@ -378,11 +378,8 @@ Example of checking for failed exec:
var spawn = require('child_process').spawn,
child = spawn('bad_command');
child.stderr.setEncoding('utf8');
child.stderr.on('data', function (data) {
if (/^execvp\(\)/.test(data)) {
console.log('Failed to start child process.');
}
child.on('error', function (err) {
console.log('Failed to start child process.');
});
Note that if spawn receives an empty options object, it will result in