11'use strict' ;
2- var common = require ( '../common' ) ;
3- var assert = require ( 'assert' ) ;
2+ const common = require ( '../common' ) ;
3+ const assert = require ( 'assert' ) ;
44
55if ( process . argv [ 2 ] !== 'child' ) {
6- var spawn = require ( 'child_process' ) . spawn ;
7- var child = spawn ( process . execPath , [ __filename , 'child' ] , {
6+ const spawn = require ( 'child_process' ) . spawn ;
7+ const child = spawn ( process . execPath , [ __filename , 'child' ] , {
88 stdio : 'pipe' //'inherit'
99 } ) ;
10- var timer = setTimeout ( function ( ) {
10+ const timer = setTimeout ( function ( ) {
1111 throw new Error ( 'child is hung' ) ;
1212 } , common . platformTimeout ( 3000 ) ) ;
13- child . on ( 'exit' , function ( code ) {
14- console . error ( 'ok' ) ;
15- assert ( ! code ) ;
13+ child . on ( 'exit' , common . mustCall ( function ( code ) {
14+ assert . strictEqual ( code , 0 ) ;
1615 clearTimeout ( timer ) ;
17- } ) ;
16+ } ) ) ;
1817} else {
1918
20- var domain = require ( 'domain' ) ;
21- var d = domain . create ( ) ;
19+ const domain = require ( 'domain' ) ;
20+ const d = domain . create ( ) ;
2221 process . maxTickDepth = 10 ;
2322
2423 // in the error handler, we trigger several MakeCallback events
@@ -40,10 +39,8 @@ if (process.argv[2] !== 'child') {
4039 }
4140
4241 f ( ) ;
43- setTimeout ( function ( ) {
42+ setImmediate ( function ( ) {
4443 console . error ( 'broke in!' ) ;
45- //process.stdout.close();
46- //process.stderr.close();
4744 process . exit ( 0 ) ;
4845 } ) ;
4946}
0 commit comments