修复在终端显示时某些情况下会有弹出多个终端的 bug

This commit is contained in:
fofolee 2022-05-18 21:19:21 +08:00
parent 0ff673c509
commit 3478bb0edb

View File

@ -258,14 +258,20 @@ let getCommandToLaunchTerminal = (cmdline, dir) => {
cd = dir ? `cd ${dir.replace(/ /g, '\\\\ ')} &&` : '';
command = fs.existsSync('/Applications/iTerm.app') ?
`osascript -e 'tell application "iTerm"
create window with default profile
tell current session of current window to write text "clear && ${cd} ${cmdline}"
end tell'` :
if application "iTerm" is running then
create window with default profile
end if
tell current session of first window to write text "clear && ${cd} ${cmdline}"
activate
end tell'` :
`osascript -e 'tell application "Terminal"
do script "clear && ${cd} ${cmdline}"
activate
end tell'`;
if application "Terminal" is running then
do script "clear && ${cd} ${cmdline}"
else
do script "clear && ${cd} ${cmdline}" in window 1
end if
activate
end tell'`;
}
return command;
}
@ -680,4 +686,4 @@ window.quickcommandHttpServer = () => {
run,
stop
}
}
}