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:
parent
f03f9f0809
commit
64effb6033
1 changed files with 5 additions and 3 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue