Commit 87dc8d1
Eric Bower
·
2026-04-16 20:32:29 -0400 EDT
parent 24305c0
fix: default to bash when running command
2 files changed,
+21,
-18
+10,
-7
| ... | ... | @@ -102,17 +102,20 @@ History: | |
| 102 | 102 | zmx history <session> | tail -100 | |
| 103 | 103 | ||
| 104 | 104 | Run: | |
| 105 | - | Commands are passed as-is; do not wrap in quotes. | |
| 106 | - | Commands run sequentially; do not send multiple in parallel. | |
| 107 | - | Avoid interactive programs (pagers, editors, prompts) -- they hang. | |
| 108 | - | ||
| 109 | - | `-d` will detach from the calling terminal. Use `wait` to track | |
| 110 | - | its status. | |
| 105 | + | Commands are passed as-is: do not wrap in quotes. | |
| 106 | + | Commands run sequentially: do not send multiple in parallel. | |
| 107 | + | Avoid interactive programs (pagers, editors, prompts): they hang. | |
| 111 | 108 | ||
| 112 | 109 | `--fish` is required when the session runs fish shell. | |
| 113 | 110 | ||
| 114 | 111 | If the command hangs, send Ctrl+C to recover: | |
| 115 | - | zmx run <session> $'\\x03' | |
| 112 | + | zmx run <session> $(printf '\x03') | |
| 113 | + | ||
| 114 | + | If the command hangs, print the history to see the error: | |
| 115 | + | zmx history <session> | tail -100 | |
| 116 | + | ||
| 117 | + | `-d` will detach from the calling terminal. Use `wait` to track | |
| 118 | + | its status. | |
| 116 | 119 | ||
| 117 | 120 | Examples: | |
| 118 | 121 | zmx run dev ls |
+11,
-11
| ... | ... | @@ -154,12 +154,9 @@ pub fn main() !void { | |
| 154 | 154 | ||
| 155 | 155 | var cmd_args_raw: std.ArrayList([]const u8) = .empty; | |
| 156 | 156 | defer cmd_args_raw.deinit(alloc); | |
| 157 | - | const shell = util.detectShell(); | |
| 158 | - | var shell_basename = std.fs.path.basename(shell); | |
| 157 | + | var shell_basename: []const u8 = "bash"; | |
| 159 | 158 | var detached = false; | |
| 160 | 159 | while (args.next()) |arg| { | |
| 161 | - | // TODO: detect shell within the session instead of asking the user to tell us | |
| 162 | - | // if the shell is fish. | |
| 163 | 160 | // Because fish tracks exit code status via $status instead of $? we need some | |
| 164 | 161 | // way to figure out what shell is being used inside the session. | |
| 165 | 162 | if (std.mem.startsWith(u8, arg, "--fish")) { |
| ... | ... | @@ -1160,17 +1157,20 @@ fn help() !void { | |
| 1160 | 1157 | \\ zmx history <session> | tail -100 | |
| 1161 | 1158 | \\ | |
| 1162 | 1159 | \\Run: | |
| 1163 | - | \\ Commands are passed as-is; do not wrap in quotes. | |
| 1164 | - | \\ Commands run sequentially; do not send multiple in parallel. | |
| 1165 | - | \\ Avoid interactive programs (pagers, editors, prompts) -- they hang. | |
| 1166 | - | \\ | |
| 1167 | - | \\ `-d` will detach from the calling terminal. Use `wait` to track | |
| 1168 | - | \\ its status. | |
| 1160 | + | \\ Commands are passed as-is: do not wrap in quotes. | |
| 1161 | + | \\ Commands run sequentially: do not send multiple in parallel. | |
| 1162 | + | \\ Avoid interactive programs (pagers, editors, prompts): they hang. | |
| 1169 | 1163 | \\ | |
| 1170 | 1164 | \\ `--fish` is required when the session runs fish shell. | |
| 1171 | 1165 | \\ | |
| 1172 | 1166 | \\ If the command hangs, send Ctrl+C to recover: | |
| 1173 | - | \\ zmx run <session> printf '\x03' | |
| 1167 | + | \\ zmx run <session> $(printf '\x03') | |
| 1168 | + | \\ | |
| 1169 | + | \\ If the command hangs, print the history to see the error: | |
| 1170 | + | \\ zmx history <session> | tail -100 | |
| 1171 | + | \\ | |
| 1172 | + | \\ `-d` will detach from the calling terminal. Use `wait` to track | |
| 1173 | + | \\ its status. | |
| 1174 | 1174 | \\ | |
| 1175 | 1175 | \\ Examples: | |
| 1176 | 1176 | \\ zmx run dev ls |