From 5ada5adda28282d62e1abfb21801e79be0d801e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Tue, 8 Mar 2022 16:34:21 +0000 Subject: [PATCH] fix(core): fix daemon server path on client (#9235) --- .../project-graph/daemon/client/client.ts | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/workspace/src/core/project-graph/daemon/client/client.ts b/packages/workspace/src/core/project-graph/daemon/client/client.ts index 3b093e5330608..4e09e226333e1 100644 --- a/packages/workspace/src/core/project-graph/daemon/client/client.ts +++ b/packages/workspace/src/core/project-graph/daemon/client/client.ts @@ -4,6 +4,7 @@ import { ChildProcess, spawn, spawnSync } from 'child_process'; import { openSync, readFileSync } from 'fs'; import { ensureDirSync, ensureFileSync } from 'fs-extra'; import { connect } from 'net'; +import { join } from 'path'; import { performance } from 'perf_hooks'; import { output } from '../../../../utilities/output'; import { @@ -23,13 +24,17 @@ export async function startInBackground(): Promise { const out = openSync(DAEMON_OUTPUT_LOG_FILE, 'a'); const err = openSync(DAEMON_OUTPUT_LOG_FILE, 'a'); - const backgroundProcess = spawn(process.execPath, ['../server/start.js'], { - cwd: appRootPath, - stdio: ['ignore', out, err], - detached: true, - windowsHide: true, - shell: false, - }); + const backgroundProcess = spawn( + process.execPath, + [join(__dirname, '../server/start.js')], + { + cwd: appRootPath, + stdio: ['ignore', out, err], + detached: true, + windowsHide: true, + shell: false, + } + ); backgroundProcess.unref(); // Persist metadata about the background process so that it can be cleaned up later if needed @@ -84,7 +89,7 @@ export function startInCurrentProcess(): void { title: `Daemon Server - Starting in the current process...`, }); - spawnSync(process.execPath, ['../server/start.js'], { + spawnSync(process.execPath, [join(__dirname, '../server/start.js')], { cwd: appRootPath, stdio: 'inherit', });