| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b2b2bc2 commit 4e36a14
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,24 +1,23 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - var common = require('../common'); | ||
| 3 | - var assert = require('assert'); | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | 4 | ||
| 5 | 5 | if (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'], { | ||
| 8 | 8 | stdio: 'pipe'//'inherit' | |
| 9 | 9 | }); | |
| 10 | - var timer = setTimeout(function() { | ||
| 10 | + const timer = setTimeout(function() { | ||
| 11 | 11 | throw new Error('child is hung'); | |
| 12 | 12 | }, 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); | ||
| 16 | 15 | clearTimeout(timer); | |
| 17 | - }); | ||
| 16 | + })); | ||
| 18 | 17 | } else { | |
| 19 | 18 | ||
| 20 | - var domain = require('domain'); | ||
| 21 | - var d = domain.create(); | ||
| 19 | + const domain = require('domain'); | ||
| 20 | + const d = domain.create(); | ||
| 22 | 21 | process.maxTickDepth = 10; | |
| 23 | 22 | ||
| 24 | 23 | // in the error handler, we trigger several MakeCallback events | |
@@ -40,10 +39,8 @@ if (process.argv[2] !== 'child') { | |||
| 40 | 39 | } | |
| 41 | 40 | ||
| 42 | 41 | f(); | |
| 43 | - setTimeout(function() { | ||
| 42 | + setImmediate(function() { | ||
| 44 | 43 | console.error('broke in!'); | |
| 45 | - //process.stdout.close(); | ||
| 46 | - //process.stderr.close(); | ||
| 47 | 44 | process.exit(0); | |
| 48 | 45 | }); | |
| 49 | 46 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments