2011-07-05 19:07:08 +08:00
|
|
|
require('../common');
|
2011-08-25 06:18:39 +08:00
|
|
|
var util = require('util');
|
2011-07-05 19:07:08 +08:00
|
|
|
var assert = require('assert');
|
|
|
|
var exec = require('child_process').exec;
|
|
|
|
|
|
|
|
var success_count = 0;
|
|
|
|
var error_count = 0;
|
|
|
|
|
2015-03-12 09:16:26 +08:00
|
|
|
var cmd = ['"' + process.execPath + '"', '-e', '"console.error(process.argv)"',
|
2012-01-18 02:43:34 +08:00
|
|
|
'foo', 'bar'].join(' ');
|
2011-10-05 06:08:18 +08:00
|
|
|
var expected = util.format([process.execPath, 'foo', 'bar']) + '\n';
|
2011-07-05 19:07:08 +08:00
|
|
|
var child = exec(cmd, function(err, stdout, stderr) {
|
|
|
|
if (err) {
|
|
|
|
console.log(err.toString());
|
|
|
|
++error_count;
|
|
|
|
return;
|
|
|
|
}
|
2011-07-26 05:54:44 +08:00
|
|
|
assert.equal(stderr, expected);
|
2011-07-05 19:07:08 +08:00
|
|
|
++success_count;
|
|
|
|
});
|
|
|
|
|
2011-10-15 07:08:36 +08:00
|
|
|
process.on('exit', function() {
|
2011-07-05 19:07:08 +08:00
|
|
|
assert.equal(1, success_count);
|
|
|
|
assert.equal(0, error_count);
|
|
|
|
});
|
|
|
|
|