diff --git a/assets/templates/settings.html b/assets/templates/settings.html index cf0f31e..654ac33 100644 --- a/assets/templates/settings.html +++ b/assets/templates/settings.html @@ -13,5 +13,4 @@ Clean blockchain data - - 1 \ No newline at end of file + \ No newline at end of file diff --git a/bin/StopGeth.dll b/bin/StopGeth.dll new file mode 100644 index 0000000..ffe0b1c Binary files /dev/null and b/bin/StopGeth.dll differ diff --git a/bin/WrapGeth.exe b/bin/WrapGeth.exe new file mode 100644 index 0000000..da2f284 Binary files /dev/null and b/bin/WrapGeth.exe differ diff --git a/modules/geth.js b/modules/geth.js index 4499a08..70eb717 100644 --- a/modules/geth.js +++ b/modules/geth.js @@ -1,12 +1,18 @@ const child_process = require('child_process'); const {app, dialog} = require('electron'); const path = require('path'); +const fs = require('fs'); class Geth { constructor() { this.gethProcess = null; + this.logStream = fs.createWriteStream(path.join(app.getPath('userData'), 'gethlog.txt')); } + _writeLog(text) { + this.logStream.write(text); + } + startGeth() { // get the path of get and execute the child process try { @@ -17,10 +23,10 @@ class Geth { app.quit(); }); this.gethProcess.stderr.on('data', function(data) { - console.log(data.toString()); + EthoGeth._writeLog(data.toString() + '\n'); }); this.gethProcess.stdout.on('data', function(data) { - console.log(data.toString()); + EthoGeth._writeLog(data.toString() + '\n'); }); } catch (e) { dialog.showErrorBox("Error starting application", e); @@ -29,7 +35,8 @@ class Geth { } stopGeth() { - this.gethProcess.kill('SIGINT'); + const gethWrapePath = path.join(app.getPath('userData'), 'WrapGeth.exe'); + child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]); } }