mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
818 B
43 lines
818 B
14 years ago
|
var common = require('../common');
|
||
|
var assert = require('assert');
|
||
15 years ago
|
|
||
|
var spawn = require('child_process').spawn;
|
||
|
|
||
13 years ago
|
var is_windows = process.platform === 'win32';
|
||
|
|
||
15 years ago
|
var exitCode;
|
||
|
var termSignal;
|
||
15 years ago
|
var gotStdoutEOF = false;
|
||
|
var gotStderrEOF = false;
|
||
|
|
||
13 years ago
|
var cat = spawn(is_windows ? 'cmd' : 'cat');
|
||
15 years ago
|
|
||
|
|
||
13 years ago
|
cat.stdout.on('end', function() {
|
||
15 years ago
|
gotStdoutEOF = true;
|
||
|
});
|
||
|
|
||
13 years ago
|
cat.stderr.on('data', function(chunk) {
|
||
15 years ago
|
assert.ok(false);
|
||
|
});
|
||
|
|
||
13 years ago
|
cat.stderr.on('end', function() {
|
||
15 years ago
|
gotStderrEOF = true;
|
||
|
});
|
||
|
|
||
13 years ago
|
cat.on('exit', function(code, signal) {
|
||
15 years ago
|
exitCode = code;
|
||
|
termSignal = signal;
|
||
15 years ago
|
});
|
||
|
|
||
13 years ago
|
assert.equal(cat.killed, false);
|
||
14 years ago
|
cat.kill();
|
||
13 years ago
|
assert.equal(cat.killed, true);
|
||
14 years ago
|
|
||
13 years ago
|
process.on('exit', function() {
|
||
15 years ago
|
assert.strictEqual(exitCode, null);
|
||
|
assert.strictEqual(termSignal, 'SIGTERM');
|
||
15 years ago
|
assert.ok(gotStdoutEOF);
|
||
|
assert.ok(gotStderrEOF);
|
||
|
});
|