mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
test: fix flaky test-debug-prompt
Be sure to send `.exit` only once to avoid spurious EPIPE and possibly other errors. Fixes: https://github.com/nodejs/node/issues/21724 PR-URL: https://github.com/nodejs/node/pull/21826 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
This commit is contained in:
parent
a8ec288884
commit
df97126173
|
|
@ -7,9 +7,12 @@ const spawn = require('child_process').spawn;
|
|||
const proc = spawn(process.execPath, ['inspect', 'foo']);
|
||||
proc.stdout.setEncoding('utf8');
|
||||
|
||||
let needToSendExit = true;
|
||||
let output = '';
|
||||
proc.stdout.on('data', (data) => {
|
||||
output += data;
|
||||
if (output.includes('debug> '))
|
||||
if (output.includes('debug> ') && needToSendExit) {
|
||||
proc.stdin.write('.exit\n');
|
||||
needToSendExit = false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user