mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-10 07:19:02 +08:00
fix(codetool): incorrect codetool workdir on macOS (#10056)
fix(codetool): run command and cd in same shell on macOS
This commit is contained in:
parent
dbd090377d
commit
d35998bd74
@ -332,14 +332,15 @@ class CodeToolsService {
|
|||||||
// macOS - Use osascript to launch terminal and execute command directly, without showing startup command
|
// macOS - Use osascript to launch terminal and execute command directly, without showing startup command
|
||||||
const envPrefix = buildEnvPrefix(false)
|
const envPrefix = buildEnvPrefix(false)
|
||||||
const command = envPrefix ? `${envPrefix} && ${baseCommand}` : baseCommand
|
const command = envPrefix ? `${envPrefix} && ${baseCommand}` : baseCommand
|
||||||
|
// Combine directory change with the main command to ensure they execute in the same shell session
|
||||||
|
const fullCommand = `cd '${directory.replace(/'/g, "\\'")}' && clear && ${command}`
|
||||||
|
|
||||||
terminalCommand = 'osascript'
|
terminalCommand = 'osascript'
|
||||||
terminalArgs = [
|
terminalArgs = [
|
||||||
'-e',
|
'-e',
|
||||||
`tell application "Terminal"
|
`tell application "Terminal"
|
||||||
set newTab to do script "cd '${directory.replace(/'/g, "\\'")}' && clear"
|
do script "${fullCommand.replace(/"/g, '\\"')}"
|
||||||
activate
|
activate
|
||||||
do script "${command.replace(/"/g, '\\"')}" in newTab
|
|
||||||
end tell`
|
end tell`
|
||||||
]
|
]
|
||||||
break
|
break
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user