Skip to content

Commit

Permalink
fix child error occurring before child variable assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
TakenPilot committed Dec 6, 2016
1 parent 539ddf9 commit 14088c8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/browser/services/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const appName = 'Rodeo',
};

let trackGA = createTrackGA({metricsUrl: 'https://ssl.google-analytics.com/collect'}),
trackYhat = createTrackGA({metricsUrl: 'https://analytics.yhat.com/collect'});
trackYhat = createTrackGA({metricsUrl: 'http://analytics.yhat.com/collect'});

/**
* @typedef {object} TrackingEvent
Expand Down
11 changes: 2 additions & 9 deletions src/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ import applicationMenu from './application-menu.yml';
// enable source-maps
require('source-map-support').install();

console.log('>???', args, {__dirname, __filename});

const argv = args.getArgv(),
log = require('./services/log').asInternal(__filename),
staticFileDir = path.resolve(__dirname),
staticFileDir = path.resolve(electron.app.getAppPath()),
kernelClients = {},
windowUrls = {
mainWindow: 'main.html',
Expand Down Expand Up @@ -984,7 +982,7 @@ function attachAppEvents(app) {
});
app.on('window-all-closed', () => {
log('info', 'onWindowAllClosed');
quitApplication();
return quitApplication();
});
app.on('ready', onReady);
}
Expand All @@ -997,9 +995,4 @@ function startPlotServer() {
.catch(error => log('critical', 'failure to start plot server', error));
}

module.exports.onCloseWindow = onCloseWindow;
module.exports.onFiles = onFiles;
module.exports.onPDF = onPDF;
module.exports.onReady = onReady;

startApp();
7 changes: 3 additions & 4 deletions src/node/services/log.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import _ from 'lodash';
import electronWinstonTransport from './electron-winston-transport';
import path from 'path';
Expand All @@ -16,8 +14,7 @@ let electronTransport = new winston.transports.ElectronLogger({
}),
consoleTransport = new winston.transports.Console({
level: 'info',
colorize: true,
humanReadableUnhandledException: true
colorize: true
}),
fileTransport = new winston.transports.File({
filename: path.join(require('os').homedir(), 'rodeo.log'),
Expand All @@ -39,6 +36,8 @@ let electronTransport = new winston.transports.ElectronLogger({
exitOnError: false
});

// stop winston from interfering
winston.exitOnError = false;
winston.handleExceptions(transports);

/**
Expand Down
12 changes: 6 additions & 6 deletions src/node/services/processes.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ function create(cmd, args, options) {

const errors = [],
details = {cmd, args, options},
child = childProcess.spawn(cmd, args, options)
.on('error', error => {
errors.push(error);
errorInChild(child, error, details);
})
.on('close', (code, signal) => removeChild(child, _.assign({code, signal, errors}, details)));
child = childProcess.spawn(cmd, args, options);

child.on('error', error => {
errors.push(error);
errorInChild(child, error, details);
}).on('close', (code, signal) => removeChild(child, _.assign({code, signal, errors}, details)));

addChild(child, details);
return child;
Expand Down
4 changes: 2 additions & 2 deletions webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ module.exports = {
},
node: {
// we want the real location of files on the server-side
__filename: false,
__dirname: false
__filename: true,
__dirname: true
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
Expand Down

0 comments on commit 14088c8

Please sign in to comment.