fix escaping

This commit is contained in:
Peter Steinberger 2025-06-18 05:02:14 +02:00
parent 95cec4c801
commit db1583b88b

View file

@ -507,19 +507,14 @@ final class TerminalLauncher {
let ttyFwd = ttyFwdPath ?? findTTYFwdBinary() let ttyFwd = ttyFwdPath ?? findTTYFwdBinary()
// The command comes pre-formatted from Rust, just launch it // The command comes pre-formatted from Rust, just launch it
// This avoids double escaping issues // Pass the working directory separately to avoid double-escaping issues
// Properly escape the directory path for shell
let escapedDir = expandedWorkingDir.replacingOccurrences(of: "\\", with: "\\\\")
.replacingOccurrences(of: "\"", with: "\\\"")
let fullCommand = "cd \"\(escapedDir)\" && \(command)"
// Get the preferred terminal or fallback // Get the preferred terminal or fallback
let terminal = getValidTerminal() let terminal = getValidTerminal()
// Launch with configuration // Launch with configuration - let TerminalLaunchConfig handle the escaping
let config = TerminalLaunchConfig( let config = TerminalLaunchConfig(
command: fullCommand, command: command,
workingDirectory: nil, workingDirectory: expandedWorkingDir,
terminal: terminal terminal: terminal
) )
try launchWithConfig(config) try launchWithConfig(config)