From a09ace091f6a45b95e7a8e809491d37de2cd2e3a Mon Sep 17 00:00:00 2001 From: Gordon Hall Date: Wed, 11 Jan 2017 13:08:31 -0500 Subject: [PATCH] switch back to fork --- lib/api.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/api.js b/lib/api.js index b757896..6e39653 100644 --- a/lib/api.js +++ b/lib/api.js @@ -5,7 +5,7 @@ const fs = require('fs'); const {statSync, readFileSync} = require('fs'); const stripJsonComments = require('strip-json-comments'); const JsonLogger = require('kad-logger-json'); -const {spawn} = require('child_process'); +const {fork} = require('child_process'); const utils = require('./utils'); const path = require('path'); @@ -20,7 +20,6 @@ class RPC { constructor(options={}) { this.logger = new JsonLogger(options.logVerbosity); this.shares = new Map(); - this._execPath = options.execPath || 'node'; } /** @@ -99,12 +98,11 @@ class RPC { let uptimeCounter = setInterval(() => share.meta.uptimeMs += 1000, 1000); // NB: Fork the actual farmer process, passing it the configuration - share.process = spawn( - self._execPath, - [path.join(__dirname, '../script/farmer.js'), '--config', configPath], + share.process = fork( + path.join(__dirname, '../script/farmer.js'), + ['--config', configPath], { - stdio: [0, 'pipe', 'pipe', 'ipc'], - detached: false + stdio: [0, 'pipe', 'pipe', 'ipc'] } ); share.readyState = RPC.SHARE_STARTED;