blob: 19921bcb132213506afaa1f7997d6574d3eff6ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
var exitCode;
var termSignal;
var gotStdoutEOF = false;
var gotStderrEOF = false;
var cat = spawn("cat");
cat.stdout.addListener("data", function (chunk) {
assert.ok(false);
});
cat.stdout.addListener("end", function () {
gotStdoutEOF = true;
});
cat.stderr.addListener("data", function (chunk) {
assert.ok(false);
});
cat.stderr.addListener("end", function () {
gotStderrEOF = true;
});
cat.addListener("exit", function (code, signal) {
exitCode = code;
termSignal = signal;
});
cat.kill();
process.addListener("exit", function () {
assert.strictEqual(exitCode, null);
assert.strictEqual(termSignal, 'SIGTERM');
assert.ok(gotStdoutEOF);
assert.ok(gotStderrEOF);
});
|