Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 13373f5

Browse files
committed
fix(launcher): output error messages when child processes exit with error
Version 0.24.0 introduced a bug where child processes would error without outputting the error message. Fix. See #902.
1 parent 72668fe commit 13373f5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/launcher.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ var init = function(configFile, additionalConfig) {
9393
});
9494

9595
this.process.on('error', function(err) {
96+
self.reporter.flush();
9697
log_('Runner Process(' + self.process.pid + ') Error: ' + err);
9798
launcherExitCode = 1;
9899
});
99100

100101
this.process.on('exit', function(code) {
102+
self.reporter.flush();
101103
if (code) {
102104
log_('Runner Process Exited With Error Code: ' + code);
103105
launcherExitCode = 1;
@@ -224,7 +226,7 @@ var TaskReporter_ = function(task, pid) {
224226
TaskReporter_.prototype.reportHeader_ = function() {
225227
var capability = this.task.capability;
226228
var eol = require('os').EOL;
227-
var output = '------------------------------------' + eol;
229+
var output = eol + '------------------------------------' + eol;
228230
output += 'PID: ' + this.pid + ' (capability: ';
229231
output += (capability.browserName) ?
230232
capability.browserName : '';
@@ -267,9 +269,17 @@ TaskReporter_.prototype.logStderr = function(stderr) {
267269
*/
268270
TaskReporter_.prototype.testsDone = function(failedCount) {
269271
this.failedCount = failedCount;
272+
this.flush();
273+
};
274+
275+
/**
276+
* Flushes the buffer to stdout.
277+
*/
278+
TaskReporter_.prototype.flush = function(failedCount) {
270279
if (this.buffer) {
271280
// Flush buffer if nonempty
272281
process.stdout.write(this.buffer);
282+
this.buffer = '';
273283
}
274284
};
275285

0 commit comments

Comments
 (0)