mirror of
https://github.com/nodejs/node.git
synced 2024-11-25 08:19:38 +01:00
d53b636d94
This commit validates the properties of ENOENT error objects returned by spawn() and spawnSync(). PR-URL: https://github.com/iojs/io.js/pull/838 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rod Vagg <rod@vagg.org>
25 lines
636 B
JavaScript
25 lines
636 B
JavaScript
var common = require('../common');
|
|
var fs = require('fs');
|
|
var spawn = require('child_process').spawn;
|
|
var assert = require('assert');
|
|
|
|
var errors = 0;
|
|
|
|
var enoentPath = 'foo123';
|
|
var spawnargs = ['bar'];
|
|
assert.equal(common.fileExists(enoentPath), false);
|
|
|
|
var enoentChild = spawn(enoentPath, spawnargs);
|
|
enoentChild.on('error', function (err) {
|
|
assert.equal(err.code, 'ENOENT');
|
|
assert.equal(err.errno, 'ENOENT');
|
|
assert.equal(err.syscall, 'spawn ' + enoentPath);
|
|
assert.equal(err.path, enoentPath);
|
|
assert.deepEqual(err.spawnargs, spawnargs);
|
|
errors++;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(1, errors);
|
|
});
|