Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
use spawn with detached
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon Hall committed Jan 11, 2017
1 parent a3cf60e commit fc68fa8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {fork} = require('child_process');
const {spawn} = require('child_process');
const utils = require('./utils');
const path = require('path');

Expand All @@ -20,6 +20,7 @@ class RPC {
constructor(options={}) {
this.logger = new JsonLogger(options.logVerbosity);
this.shares = new Map();
this._execPath = options.execPath || 'node';
}

/**
Expand Down Expand Up @@ -98,9 +99,9 @@ class RPC {
let uptimeCounter = setInterval(() => share.meta.uptimeMs += 1000, 1000);

// NB: Fork the actual farmer process, passing it the configuration
share.process = fork(
path.join(__dirname, '../script/farmer.js'),
['--config', configPath],
share.process = spawn(
self._execPath,
[path.join(__dirname, '../script/farmer.js'), '--config', configPath],
{
stdio: [0, 'pipe', 'pipe', 'ipc'],
detached: false
Expand Down

0 comments on commit fc68fa8

Please sign in to comment.