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