feat(process): update zsh shell to interactive mode for full PATH access

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-06-07 23:13:49 -07:00
parent f03f9f0809
commit 64effb6033

View file

@ -31,14 +31,16 @@ public enum ProcessRunner {
stderr: String(decoding: e, as: UTF8.self))
}
/// Run a command string under a login shell (`/bin/zsh -lc`) so the user's
/// PATH (bun, uv, ) is available even from a GUI app's minimal environment.
/// Run a command string under an interactive login shell (`/bin/zsh -ilc`) so
/// the user's full PATH (bun in ~/.bun/bin, uv, ) is available even from a GUI
/// app's minimal environment. `-i` is required because bun's PATH is exported
/// from ~/.zshrc, which a non-interactive login shell does NOT source.
/// Output is drained on background queues to avoid pipe-buffer deadlock, and
/// the process is terminated if it exceeds `timeout`.
public static func runShell(_ command: String, timeout: TimeInterval, cwd: String? = nil) -> ProcessResult {
let p = Process()
p.executableURL = URL(fileURLWithPath: "/bin/zsh")
p.arguments = ["-lc", command]
p.arguments = ["-ilc", command]
if let cwd { p.currentDirectoryURL = URL(fileURLWithPath: cwd) }
let out = Pipe()
let err = Pipe()