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'; |
'use strict'; |
||||
|
|
||||
const assert = require('assert'); |
require('../common'); |
||||
const common = require('../common'); |
|
||||
const spawn = require('child_process').spawn; |
const spawn = require('child_process').spawn; |
||||
|
|
||||
const proc = spawn(process.execPath, ['debug', 'foo']); |
const proc = spawn(process.execPath, ['debug', 'foo']); |
||||
proc.stdout.setEncoding('utf8'); |
proc.stdout.setEncoding('utf8'); |
||||
|
|
||||
proc.stdout.once('data', common.mustCall((data) => { |
let output = ''; |
||||
assert.strictEqual(data, 'debug> '); |
proc.stdout.on('data', (data) => { |
||||
proc.kill(); |
output += data; |
||||
})); |
if (output.includes('debug> ')) |
||||
|
proc.kill(); |
||||
|
}); |
||||
|
Loading…
Reference in new issue