File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change 20
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
22
22
'use strict' ;
23
- const common = require ( '../common' ) ;
23
+ require ( '../common' ) ;
24
24
const assert = require ( 'assert' ) ;
25
25
const spawn = require ( 'child_process' ) . spawn ;
26
26
27
- const child = common . isWindows ? spawn ( 'cmd.exe' ) : spawn ( 'cat' ) ;
27
+ const cat = spawn ( 'cat' ) ;
28
+ let called ;
28
29
29
- assert . ok ( process . kill ( child . pid , 0 ) ) ;
30
+ assert . ok ( process . kill ( cat . pid , 0 ) ) ;
30
31
31
- child . on ( 'exit' , common . mustCall ( function ( ) {
32
+ cat . on ( 'exit' , function ( ) {
32
33
assert . throws ( function ( ) {
33
- process . kill ( child . pid , 0 ) ;
34
+ process . kill ( cat . pid , 0 ) ;
34
35
} , Error ) ;
35
- } ) ) ;
36
+ } ) ;
36
37
37
- child . stdout . on ( 'data' , common . mustCall ( function ( ) {
38
- process . kill ( child . pid , 'SIGKILL' ) ;
39
- } ) ) ;
38
+ cat . stdout . on ( 'data' , function ( ) {
39
+ called = true ;
40
+ process . kill ( cat . pid , 'SIGKILL' ) ;
41
+ } ) ;
40
42
41
43
// EPIPE when null sig fails
42
- child . stdin . write ( 'test' ) ;
44
+ cat . stdin . write ( 'test' ) ;
45
+
46
+ process . on ( 'exit' , function ( ) {
47
+ assert . ok ( called ) ;
48
+ } ) ;
You can’t perform that action at this time.
0 commit comments