boot swarm with spawn

This commit is contained in:
Jonathan Rainville 2018-05-28 12:54:06 -04:00
parent 8655b49a39
commit c86c50fb4e
1 changed files with 8 additions and 11 deletions

View File

@ -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) {