Skip to content

Commit ff50643

Browse files
authored
Fix: pass working directory for spawn command (#87)
1 parent a05b924 commit ff50643

File tree

1 file changed

+3
-2
lines changed
  • packages/main/src/modules

1 file changed

+3
-2
lines changed

packages/main/src/modules/ipc.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join } from 'path';
1+
import { join, dirname } from 'path';
22
import fs from 'node:fs';
33
import { spawn } from 'child_process';
44
import { app, BrowserWindow, ipcMain } from 'electron';
@@ -196,6 +196,7 @@ export async function launchExplorer(event: Electron.IpcMainInvokeEvent, version
196196
analytics.track(ANALYTICS_EVENT.LAUNCH_CLIENT_START, { version: versionData.version });
197197

198198
const explorerBinPath = getExplorerBinPath(version);
199+
const explorerBinDir = dirname(explorerBinPath);
199200

200201
if (!fs.existsSync(explorerBinPath)) {
201202
const errorMessage = version ? `The explorer version specified: ${version} is not installed.` : 'The explorer is not installed.';
@@ -221,7 +222,7 @@ export async function launchExplorer(event: Electron.IpcMainInvokeEvent, version
221222
analytics.getSessionId(),
222223
].filter(arg => !!arg);
223224
log.info('[Main Window][IPC][LaunchExplorer] Opening the Explorer', explorerParams);
224-
spawn(explorerBinPath, explorerParams, { detached: true, stdio: 'ignore' })
225+
spawn(explorerBinPath, explorerParams, { cwd: explorerBinDir, detached: true, stdio: 'ignore' })
225226
.on('spawn', async () => {
226227
event.sender.send(IPC_EVENTS.LAUNCH_EXPLORER, { type: IPC_EVENT_DATA_TYPE.LAUNCHED });
227228
await analytics.track(ANALYTICS_EVENT.LAUNCH_CLIENT_SUCCESS, { version: versionData.version });

0 commit comments

Comments
 (0)