test: fix flaky test-preload

Use `close` event rather than `exit` event to make sure all output has
been received before checking assertions.

PR-URL: https://github.com/nodejs/node/pull/6728
Fixes: https://github.com/nodejs/node/issues/6722
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Rich Trott authored and Evan Lucas committed 2016-05-17 08:52:36 -05:00
1 parent adb2d610e6
commit 1389a4fc5e
1 file changed
+2 -2
+2 -2
View File
@@ -81,7 +81,7 @@ var stdinStdout = '';
stdinProc.stdout.on('data', function(d) {
stdinStdout += d;
});
stdinProc.on('exit', function(code) {
stdinProc.on('close', function(code) {
assert.equal(code, 0);
assert.equal(stdinStdout, 'A\nhello\n');
});
@@ -97,7 +97,7 @@ var replStdout = '';
replProc.stdout.on('data', function(d) {
replStdout += d;
});
replProc.on('exit', function(code) {
replProc.on('close', function(code) {
assert.equal(code, 0);
const output = [
'A',