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 <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>
  • 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.