From 2dede09285a88e5e118fdb925ba15d6ffc11d95f Mon Sep 17 00:00:00 2001 From: fofolee Date: Sat, 27 Mar 2021 19:36:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E9=80=9A=E8=BF=87=20newcommand=20=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=EF=BC=8C=E4=BC=9A=E5=87=BA=E7=8E=B0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=97=A0=E6=B3=95=E7=82=B9=E5=87=BB=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/preload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/preload.js b/src/preload.js index 1c159de..7632bbc 100644 --- a/src/preload.js +++ b/src/preload.js @@ -389,7 +389,8 @@ if (process.platform == 'win32') quickcommand.runVbs = function (script) { // 在终端中执行 if (process.platform !== 'linux') quickcommand.runInTerminal = function (cmdline, dir) { - let command = getCommandToLaunchTerminal(cmdline, dir) + let command = getCommandToLaunchTerminal(cmdline.replace(/"/g, `\\"`), dir) + console.log(command); child_process.exec(command) } @@ -412,7 +413,6 @@ let getCommandToLaunchTerminal = (cmdline, dir) => { iterm = 'iTerm' } if (dir) cd = `cd ${dir.replace(/ /g, `\\\\ `)} &&` - cmdline = cmdline.replace(/"/g, `\\"`) if (iterm) { command = `osascript -e 'tell application "${iterm}" create window with default profile