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

Commit

Permalink
fix(launcher): output error messages when child processes exit with e…
Browse files Browse the repository at this point in the history
…rror

Version 0.24.0 introduced a bug where child processes would error without outputting
the error message. Fix. See #902.
  • Loading branch information
juliemr committed Jun 9, 2014
1 parent 72668fe commit 13373f5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ var init = function(configFile, additionalConfig) {
});

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

this.process.on('exit', function(code) {
self.reporter.flush();
if (code) {
log_('Runner Process Exited With Error Code: ' + code);
launcherExitCode = 1;
Expand Down Expand Up @@ -224,7 +226,7 @@ var TaskReporter_ = function(task, pid) {
TaskReporter_.prototype.reportHeader_ = function() {
var capability = this.task.capability;
var eol = require('os').EOL;
var output = '------------------------------------' + eol;
var output = eol + '------------------------------------' + eol;
output += 'PID: ' + this.pid + ' (capability: ';
output += (capability.browserName) ?
capability.browserName : '';
Expand Down Expand Up @@ -267,9 +269,17 @@ TaskReporter_.prototype.logStderr = function(stderr) {
*/
TaskReporter_.prototype.testsDone = function(failedCount) {
this.failedCount = failedCount;
this.flush();
};

/**
* Flushes the buffer to stdout.
*/
TaskReporter_.prototype.flush = function(failedCount) {
if (this.buffer) {
// Flush buffer if nonempty
process.stdout.write(this.buffer);
this.buffer = '';
}
};

Expand Down

0 comments on commit 13373f5

Please sign in to comment.