test: fix flaky repl-timeout-throw

Don't disconnect the child until all exceptions are thrown.

Fixes: https://github.com/nodejs/node/issues/18659

PR-URL: https://github.com/nodejs/node/pull/18692
Fixes: https://github.com/nodejs/node/issues/18659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Santiago Gimeno 2018-02-10 09:32:49 +01:00 committed by Ruben Bridgewater
parent 540cbf84af
commit 01d049165c
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
@ -13,6 +13,8 @@ child.stdout.setEncoding('utf8');
child.stdout.on('data', function(c) {
process.stdout.write(c);
stdout += c;
if (stdout.includes('> THROW 2'))
child.stdin.end();
});
child.stdin.write = function(original) {
@ -46,8 +48,6 @@ child.stdout.once('data', function() {
' });\n' +
' });\n' +
'});"";\n');
setTimeout(child.stdin.end.bind(child.stdin), common.platformTimeout(200));
}
});