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