Commit 8037703b authored by Yulian Kuncheff's avatar Yulian Kuncheff

Fix handling of spaces in path for launching Breeze Daemon, fix STDOUT logging, and add debug flag

parent bc353f30
...@@ -12,8 +12,10 @@ const os = require('os'); ...@@ -12,8 +12,10 @@ const os = require('os');
var apiProcess; var apiProcess;
let serve; let serve;
let debug;
const args = process.argv.slice(1); const args = process.argv.slice(1);
serve = args.some(val => val === "--serve"); serve = args.some(val => val === "--serve");
debug = args.some(val => val === "--debug");
if (serve) { if (serve) {
require('electron-reload')(__dirname, { require('electron-reload')(__dirname, {
...@@ -44,7 +46,7 @@ function createWindow() { ...@@ -44,7 +46,7 @@ function createWindow() {
slashes: true slashes: true
})); }));
if (serve) { if (serve || debug) {
mainWindow.webContents.openDevTools(); mainWindow.webContents.openDevTools();
} }
...@@ -115,14 +117,19 @@ function startApi() { ...@@ -115,14 +117,19 @@ function startApi() {
apipath = path.join(__dirname, '.\\assets\\daemon\\Breeze.Daemon.exe'); apipath = path.join(__dirname, '.\\assets\\daemon\\Breeze.Daemon.exe');
} }
//Handle spaces in paths
apipath = apipath.replace(/ /g, '\\ ');
apiProcess = exec(apipath + ' light -testnet', { apiProcess = exec(apipath + ' light -testnet', {
detached: true detached: true
}); }, (error, stdout, stderr) => {
if (error) {
apiProcess.stdout.on('data', (data) => { writeLogError(`exec error: ${error}`);
writeLog(`stdout: ${data}`); return;
if (mainWindow == null) { }
createWindow(); if (debug) {
writeLog(`stdout: ${stdout}`);
writeLog(`stderr: ${stderr}`);
} }
}); });
} }
...@@ -157,5 +164,9 @@ if (os.platform() === 'win32') { ...@@ -157,5 +164,9 @@ if (os.platform() === 'win32') {
}; };
function writeLog(msg) { function writeLog(msg) {
console.log(msg); console.log(msg);
};
function writeLogError(msg) {
console.error(msg);
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment