Commit a601596 1 parent fefcd82 commit a601596 Copy full SHA for a601596
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 20
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
22
22
'use strict' ;
23
- require ( '../common' ) ;
23
+ const { mustCall } = require ( '../common' ) ;
24
24
const assert = require ( 'assert' ) ;
25
- const spawn = require ( 'child_process' ) . spawn ;
25
+ const { spawn } = require ( 'child_process' ) ;
26
26
27
27
const cat = spawn ( 'cat' ) ;
28
- let called ;
29
28
30
29
assert . ok ( process . kill ( cat . pid , 0 ) ) ;
31
30
32
- cat . on ( 'exit' , function ( ) {
31
+ cat . on ( 'exit' , mustCall ( function ( ) {
33
32
assert . throws ( function ( ) {
34
33
process . kill ( cat . pid , 0 ) ;
35
34
} , Error ) ;
36
- } ) ;
35
+ } ) ) ;
37
36
38
- cat . stdout . on ( 'data' , function ( ) {
39
- called = true ;
37
+ cat . stdout . on ( 'data' , mustCall ( function ( ) {
40
38
process . kill ( cat . pid , 'SIGKILL' ) ;
41
- } ) ;
39
+ } ) ) ;
42
40
43
41
// EPIPE when null sig fails
44
42
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