From 8c5e8c504ede11859f475ab6d2845043f883dba5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 30 Dec 2023 14:46:05 -0800 Subject: [PATCH] config: skip command validation if it has a space See comment --- src/config/Config.zig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index 384f52f5d..772458b57 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1707,7 +1707,17 @@ pub fn finalize(self: *Config) !void { } } - if (self.command) |command| { + if (self.command) |command| command: { + // If the command has a space in it, we skip the check below because + // its probably a multi-argument command. These types of commands + // can contain full shell escapes and other characters and we don't + // want to reimplement that all here. The point of the check below + // is MOSTLY to find people who do `command = myshell` where "myshell" + // is installed by something like Homebrew and therefore isn't available + // to a login shell. We will do more robust checks in the future by + // simply checking if the command exited with an error. + if (std.mem.indexOf(u8, command, " ") != null) break :command; + // If the path is not absolute then we want to expand it. We use our // current path because our current path is what will be available // to our termio launcher.