Revert "fix(desktop): align shell invocation across Electron and Tauri"

This reverts commit ec3b418934.
This commit is contained in:
Pascal André
2026-04-18 21:59:35 +02:00
parent ec3b418934
commit 3ec1598bbd
2 changed files with 20 additions and 8 deletions

View File

@@ -20,10 +20,24 @@ function getDefaultShellPath(): string {
return "/bin/bash"
}
function wrapCommandForShell(command: string, shellPath: string): string {
const shellName = path.basename(shellPath)
if (shellName.includes("bash")) {
return 'if [ -f ~/.bashrc ]; then source ~/.bashrc >/dev/null 2>&1; fi; ' + command
}
if (shellName.includes("zsh")) {
return 'if [ -f ~/.zshrc ]; then source ~/.zshrc >/dev/null 2>&1; fi; ' + command
}
return command
}
function buildShellArgs(shellPath: string): string[] {
const shellName = path.basename(shellPath)
if (shellName.includes("zsh") || shellName.includes("bash")) {
return ["-i", "-l", "-c"]
if (shellName.includes("zsh")) {
return ["-l", "-i", "-c"]
}
return ["-l", "-c"]
}
@@ -45,11 +59,12 @@ export function buildUserShellCommand(userCommand: string): ShellCommand {
}
const shellPath = getDefaultShellPath()
const script = wrapCommandForShell(userCommand, shellPath)
const args = buildShellArgs(shellPath)
return {
command: shellPath,
args: [...args, userCommand],
args: [...args, script],
}
}

View File

@@ -1288,11 +1288,8 @@ fn build_shell_args(shell: &str, command: &str) -> Vec<String> {
.unwrap_or("")
.to_lowercase();
if shell_name.contains("zsh") || shell_name.contains("bash") {
vec!["-i".into(), "-l".into(), "-c".into(), command.into()]
} else {
vec!["-l".into(), "-c".into(), command.into()]
}
let _ = shell_name;
vec!["-l".into(), "-c".into(), command.into()]
}
fn first_existing(paths: Vec<Option<PathBuf>>) -> Option<String> {