Skip to content

Commit

Permalink
Removed procOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiaMineJP committed Mar 21, 2024
1 parent 7e5482e commit 1e69fd5
Showing 1 changed file with 4 additions and 36 deletions.
40 changes: 4 additions & 36 deletions packages/gui/src/util/chiaEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,15 @@ const getChiaVersion = () => {
};

const startChiaDaemon = () => {
const processOptions = {};
if (process.platform === 'win32') {
// We want to detach child daemon process from parent GUI process.
// You may think `detached: true` will do but it shows blank terminal on Windows.
// In order to hide the blank terminal while detaching child process,
// {detached: false, windowsHide: false, shell: true} works which is exact opposite of what we expect
// Please see the comment below for more details.
// https://github.com/nodejs/node/issues/21825#issuecomment-503766781
processOptions.detached = false;
processOptions.stdio = 'ignore';
processOptions.windowsHide = false;
processOptions.shell = true;
} else {
processOptions.detached = true;
// processOptions.stdio = 'ignore';
processOptions.windowsHide = true;
}

pyProc = null;

if (guessPackaged()) {
const executablePath = getExecutablePath(PY_DIST_EXECUTABLE);
console.info('Running python executable: ');

try {
if (processOptions.stdio === 'ignore') {
const subProcess = childProcess.spawn(executablePath, PY_DIST_EXEC_ARGS, processOptions);
subProcess.unref();
} else {
const Process = childProcess.spawn;
pyProc = new Process(executablePath, PY_DIST_EXEC_ARGS, processOptions);
}
const Process = childProcess.spawn;
pyProc = new Process(executablePath, PY_DIST_EXEC_ARGS);
} catch (e) {
console.info('Running python executable: Error: ');
console.info(`Script: ${executablePath} ${PY_DIST_EXEC_ARGS.join(' ')}`);
Expand All @@ -103,23 +80,14 @@ const startChiaDaemon = () => {
console.info('Running python script');
console.info(`Script: python ${PY_DEV_EXEC_ARGS.join(' ')}`);

if (processOptions.stdio === 'ignore') {
const subProcess = childProcess.spawn('python', PY_DEV_EXEC_ARGS, processOptions);
subProcess.unref();
} else {
const Process = childProcess.spawn;
pyProc = new Process('python', PY_DEV_EXEC_ARGS, processOptions);
}
const Process = childProcess.spawn;
pyProc = new Process('python', PY_DEV_EXEC_ARGS);
}

if (!pyProc) {
throw new Error('Failed to start chia daemon');
}

if (processOptions.stdio === 'ignore') {
return;
}

pyProc.stdout.setEncoding('utf8');

pyProc.stdout.on('data', (data) => {
Expand Down

0 comments on commit 1e69fd5

Please sign in to comment.