Skip to content

Commit

Permalink
test: fix flaky test-debug-prompt
Browse files Browse the repository at this point in the history
Be sure to send `.exit` only once to avoid spurious EPIPE and possibly
other errors.

Fixes: #21724

PR-URL: #21826
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
  • Loading branch information
Trott authored and targos committed Jul 16, 2018
1 parent a2edb59 commit 4e60ce8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/sequential/test-debug-prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});

0 comments on commit 4e60ce8

Please sign in to comment.