diff --git a/BrewBar/BrewBarApp.swift b/BrewBar/BrewBarApp.swift index 9db5507..9ced921 100644 --- a/BrewBar/BrewBarApp.swift +++ b/BrewBar/BrewBarApp.swift @@ -194,13 +194,15 @@ class AppDelegate: NSObject, NSApplicationDelegate { DispatchQueue.global().async { let brew = self.resolveBrewPath() let cleaned = command.replacingOccurrences(of: "brew ", with: "") - let fullCommand = "\(brew) \(cleaned)" + let arguments = [brew] + cleaned.split(separator: " ").map(String.init) - self.log("→ \(fullCommand)\n") + self.log("→ \(arguments.joined(separator: " "))\n") + // env resolves brew via PATH (covers the bare "brew" fallback) and + // execs it directly — no shell, so no metacharacter interpretation let process = Process() - process.executableURL = URL(fileURLWithPath: "/bin/zsh") - process.arguments = ["-c", fullCommand] + process.executableURL = URL(fileURLWithPath: "/usr/bin/env") + process.arguments = arguments var environment = ProcessInfo.processInfo.environment environment["SUDO_ASKPASS"] = Self.askpassURL.path