From c86c50fb4ee6a89c194b34116c6fd05d32cd5392 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 28 May 2018 12:54:06 -0400 Subject: [PATCH] boot swarm with spawn --- lib/processes/storageProcesses/swarm.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/processes/storageProcesses/swarm.js b/lib/processes/storageProcesses/swarm.js index b622404e0..bb720b3aa 100644 --- a/lib/processes/storageProcesses/swarm.js +++ b/lib/processes/storageProcesses/swarm.js @@ -1,4 +1,4 @@ -const shelljs = require('shelljs'); +const child_process = require('child_process'); const ProcessWrapper = require('../../process/processWrapper'); const constants = require('../../constants'); @@ -20,16 +20,13 @@ class SwarmProcess extends ProcessWrapper { if (self.webServerConfig && self.webServerConfig && self.webServerConfig.host && self.webServerConfig.port) { corsDomain = `http://${self.webServerConfig.host}:${self.webServerConfig.port}`; } - const child = shelljs.exec( - `${this.storageConfig.swarmPath || 'swarm'} --bzzaccount ${this.storageConfig.account.address} --password ${this.storageConfig.account.password} --corsdomain ${corsDomain} --ens-api ''`, - {silent: true}, (err, _stdout, _stderr) => - { - if (err) { - console.error(err); - process.exit(1); - } - process.exit(); - }); + const child = child_process.spawn(this.storageConfig.swarmPath || 'swarm', + [ + `--bzzaccount ${this.storageConfig.account.address}`, + `--password ${this.storageConfig.account.password}`, + `--corsdomain ${corsDomain}`, + "--ens-api ''" + ]); let lastMessage; child.stderr.on('data', (data) => { if (!self.readyCalled && data.indexOf('Swarm http proxy started') > -1) {