From 0adc73514dada1fc14b90e2289c4b0817e535478 Mon Sep 17 00:00:00 2001 From: ecmel Date: Mon, 16 Dec 2024 22:00:43 +0300 Subject: [PATCH] fixes wsl spawn bug --- src/utils/core.ts | 2 +- src/utils/cpUtils.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils/core.ts b/src/utils/core.ts index 7584fdb6..e1ff457c 100644 --- a/src/utils/core.ts +++ b/src/utils/core.ts @@ -41,7 +41,7 @@ export async function checkOpenSslInstalled(): Promise { try { const result = await tryExecuteCommand( undefined, - "openSsl", + "openssl", log, "version", ); diff --git a/src/utils/cpUtils.ts b/src/utils/cpUtils.ts index c1f5553d..241d762a 100644 --- a/src/utils/cpUtils.ts +++ b/src/utils/cpUtils.ts @@ -66,8 +66,16 @@ export async function tryExecuteCommand( let childProc: cp.ChildProcess; if (process.platform === "darwin") { // need to send the escaped working directory and command together for MacOS - workingDirectory = workingDirectory.replace(/(\s+)/g, "\\ "); + workingDirectory = workingDirectory.replace(/\s/g, "\\ "); childProc = cp.spawn(join(workingDirectory, command), args, options); + } else if (process.platform === "linux") { + childProc = cp.spawn( + workingDirectory === os.tmpdir() + ? command + : join(workingDirectory, command), + args, + options, + ); } else { childProc = cp.spawn(command, args, options); }