| 13 | const TIMEOUT = common.platformTimeout(15 * 1000); |
| 14 | |
| 15 | function spawnChildProcess(inspectorFlags, scriptContents, scriptFile) { |
| 16 | const args = [].concat(inspectorFlags); |
| 17 | if (scriptContents) { |
| 18 | args.push('-e', scriptContents); |
| 19 | } else { |
| 20 | args.push(scriptFile); |
| 21 | } |
| 22 | const child = spawn(process.execPath, args); |
| 23 | |
| 24 | const handler = tearDown.bind(null, child); |
| 25 | process.on('exit', handler); |
| 26 | process.on('uncaughtException', handler); |
| 27 | process.on('unhandledRejection', handler); |
| 28 | process.on('SIGINT', handler); |
| 29 | |
| 30 | return child; |
| 31 | } |
| 32 | |
| 33 | function makeBufferingDataCallback(dataCallback) { |
| 34 | let buffer = Buffer.alloc(0); |