Commit 16f28cf 1 parent cb6adee commit 16f28cf Copy full SHA for 16f28cf
File tree 1 file changed +6
-12
lines changed
1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- require ( '../common' ) ;
2
+ const { mustCall } = require ( '../common' ) ;
3
3
const assert = require ( 'assert' ) ;
4
- const spawn = require ( 'child_process' ) . spawn ;
4
+ const { spawn } = require ( 'child_process' ) ;
5
5
6
6
const cat = spawn ( 'cat' ) ;
7
- let called ;
8
7
9
8
assert . ok ( process . kill ( cat . pid , 0 ) ) ;
10
9
11
- cat . on ( 'exit' , function ( ) {
10
+ cat . on ( 'exit' , mustCall ( function ( ) {
12
11
assert . throws ( function ( ) {
13
12
process . kill ( cat . pid , 0 ) ;
14
13
} , Error ) ;
15
- } ) ;
14
+ } ) ) ;
16
15
17
- cat . stdout . on ( 'data' , function ( ) {
18
- called = true ;
16
+ cat . stdout . on ( 'data' , mustCall ( function ( ) {
19
17
process . kill ( cat . pid , 'SIGKILL' ) ;
20
- } ) ;
18
+ } ) ) ;
21
19
22
20
// EPIPE when null sig fails
23
21
cat . stdin . write ( 'test' ) ;
24
-
25
- process . on ( 'exit' , function ( ) {
26
- assert . ok ( called ) ;
27
- } ) ;
You can’t perform that action at this time.
0 commit comments