+ linux binaries
* use paths based on OS * minimal install
This commit is contained in:
@@ -3,6 +3,8 @@ const {app, dialog} = require('electron');
|
||||
const appRoot = require('app-root-path');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
|
||||
|
||||
class Geth {
|
||||
constructor() {
|
||||
@@ -14,6 +16,22 @@ class Geth {
|
||||
} else {
|
||||
this.rootPath = appRoot.path;
|
||||
}
|
||||
|
||||
switch(os.type()) {
|
||||
case "Linux":
|
||||
this.binaries = path.join(this.rootPath, 'bin', 'linux');
|
||||
break;
|
||||
case "Darwin":
|
||||
this.binaries = path.join(this.rootPath, 'bin', 'macos');
|
||||
break;
|
||||
case "Windows_NT":
|
||||
this.binaries = path.join(this.rootPath, 'bin', 'win');
|
||||
break;
|
||||
default:
|
||||
this.binaries = path.join(this.rootPath, 'bin', 'win');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
_writeLog(text) {
|
||||
@@ -23,7 +41,7 @@ class Geth {
|
||||
startGeth() {
|
||||
// get the path of get and execute the child process
|
||||
try {
|
||||
const gethPath = path.join(path.join(this.rootPath, 'bin'), 'geth');
|
||||
const gethPath = path.join(this.binaries, 'geth');
|
||||
this.gethProcess = child_process.spawn(gethPath, ['--ws', '--wsorigins', '*', '--wsaddr', '127.0.0.1', '--wsport', '8546', '--wsapi', 'admin,db,eth,net,miner,personal,web3']);
|
||||
this.gethProcess.on('error', function(err) {
|
||||
dialog.showErrorBox("Error starting application", "Geth failed to start!");
|
||||
@@ -42,8 +60,12 @@ class Geth {
|
||||
}
|
||||
|
||||
stopGeth() {
|
||||
const gethWrapePath = path.join(path.join(this.rootPath, 'bin'), 'WrapGeth.exe');
|
||||
child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]);
|
||||
if (os.type() == "Windows_NT") {
|
||||
const gethWrapePath = path.join(this.binaries, 'WrapGeth.exe');
|
||||
child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]);
|
||||
} else {
|
||||
this.gethProcess.kill('SIGTERM');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user