Skip to content

Instantly share code, notes, and snippets.

@chapko
Created October 26, 2016 17:27
Show Gist options
  • Save chapko/769bfd37cf8561174276d07c340a20e8 to your computer and use it in GitHub Desktop.
Save chapko/769bfd37cf8561174276d07c340a20e8 to your computer and use it in GitHub Desktop.
diff --git a/test/www/jxcore/runCoordinatedTests.js b/test/www/jxcore/runCoordinatedTests.js
index ab9104d..25dad7a 100644
--- a/test/www/jxcore/runCoordinatedTests.js
+++ b/test/www/jxcore/runCoordinatedTests.js
@@ -64,10 +64,13 @@ var logInstanceOutput = function (data, instanceId) {
var setListeners = function (instance, instanceId) {
instanceLogs[instanceId] = '';
+ var file = require('fs')
+ .createWriteStream('logs/' + instanceId + '.log', 'utf8');
instance.stdout
.on('data', function (data) {
logInstanceOutput(data, instanceId);
+ file.write(data);
if (data.indexOf('PROCESS_ON_EXIT_') >= 0) {
if (data.indexOf('PROCESS_ON_EXIT_FAILED') >= 0) {
@@ -89,14 +92,17 @@ var setListeners = function (instance, instanceId) {
instance.stderr
.on('data', function (data) {
logInstanceOutput(data, instanceId);
+ file.write(data);
});
instance.on('error', function (err) {
var error = 'Error : ' + err + '\n' + err.stack;
logInstanceOutput(error, instanceId);
+ file.write(error);
});
instance.on('exit', function (code, signal) {
var codeAndSignal = 'Exit code: ' + code + '. Exit signal: ' + signal;
logInstanceOutput(codeAndSignal, instanceId);
+ file.end(codeAndSignal);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment