mirror of https://github.com/lukechilds/node.git
Browse Source
It can happen that first data chunk received in stdout is not exactly `'debug> '`. Make sure the exit condition is met. PR-URL: https://github.com/nodejs/node/pull/10316 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>v7.x
committed by
cjihrig
1 changed files with 7 additions and 6 deletions
@ -1,13 +1,14 @@ |
|||
'use strict'; |
|||
|
|||
const assert = require('assert'); |
|||
const common = require('../common'); |
|||
require('../common'); |
|||
const spawn = require('child_process').spawn; |
|||
|
|||
const proc = spawn(process.execPath, ['debug', 'foo']); |
|||
proc.stdout.setEncoding('utf8'); |
|||
|
|||
proc.stdout.once('data', common.mustCall((data) => { |
|||
assert.strictEqual(data, 'debug> '); |
|||
let output = ''; |
|||
proc.stdout.on('data', (data) => { |
|||
output += data; |
|||
if (output.includes('debug> ')) |
|||
proc.kill(); |
|||
})); |
|||
}); |
|||
|
Loading…
Reference in new issue