Commit d469b2e
Eric Bower
·
2026-06-12 20:07:58 -0400 EDT
parent d4d5f2a
chore(ci): cleanup
7 files changed,
+11,
-38
+1,
-0
| ... | ... | @@ -3,6 +3,7 @@ | |
| 3 | 3 | .zig-cache/ | |
| 4 | 4 | zig-cache/ | |
| 5 | 5 | zig-out/ | |
| 6 | + | zig-pkg/ | |
| 6 | 7 | Session*.*vim | |
| 7 | 8 | commit_msg | |
| 8 | 9 | *.sw? |
+2,
-3
| ... | ... | @@ -12,9 +12,8 @@ Use spec: https://common-changelog.org/ | |
| 12 | 12 | ||
| 13 | 13 | ### Changed | |
| 14 | 14 | ||
| 15 | - | - *BREAKING* `zmx run` when creating session it runs `/bin/bash` instead of `$SHELL` | |
| 16 | - | - There are just too many edge cases with tracking exit status in other shells which makes | |
| 17 | - | `zmx run` much less useful for task management. | |
| 15 | + | - *BREAKING* `zmx run` when creating session it runs `bash` instead of `$SHELL` | |
| 16 | + | - There are just too many edge cases with tracking exit status in other shells which makes `zmx run` much less useful for task management. | |
| 18 | 17 | - This means when using `zmx run` the target shell must have support for `$?` exit code tracking | |
| 19 | 18 | - *BREAKING* `zmx tail` now strips ansi escape codes | |
| 20 | 19 |
+1,
-3
| ... | ... | @@ -15,8 +15,6 @@ WORKDIR /app | |
| 15 | 15 | ||
| 16 | 16 | COPY . /app/ | |
| 17 | 17 | ||
| 18 | - | RUN rm ./mise.toml | |
| 19 | - | ||
| 20 | 18 | RUN zig build | |
| 21 | 19 | ||
| 22 | - | CMD ["zig", "build", "-Doptimize=ReleaseSafe"] | |
| 20 | + | CMD ["zig", "build"] |
+0,
-7
| ... | ... | @@ -1,7 +0,0 @@ | |
| 1 | - | [tools] | |
| 2 | - | zig = "0.15.2" | |
| 3 | - | zls = "0.15.1" | |
| 4 | - | bats = "1.13.0" | |
| 5 | - | ||
| 6 | - | [tasks.test_int] | |
| 7 | - | run = "bats test/session.bats" |
M
pico.sh
+0,
-7
| ... | ... | @@ -6,13 +6,6 @@ EVENT_TYPE="${PICO_CI_EVENT_TYPE:-manual}" | |
| 6 | 6 | ||
| 7 | 7 | echo "running ci event=${EVENT_TYPE} session=${ZMX_SESSION_PREFIX}" | |
| 8 | 8 | ||
| 9 | - | if ! command -v mise &> /dev/null; then | |
| 10 | - | echo "ERR: mise is required" | |
| 11 | - | exit 1 | |
| 12 | - | fi | |
| 13 | - | ||
| 14 | - | zmx run install bash -c "mise trust && mise install" | |
| 15 | - | ||
| 16 | 9 | zmx run build docker build -t zig-zmx . | |
| 17 | 10 | zmx run fmt -d docker run --rm -t zig-zmx:latest zig fmt --check . | |
| 18 | 11 | zmx run test -d docker run --rm -t zig-zmx:latest zig build test |
+5,
-17
| ... | ... | @@ -1140,30 +1140,14 @@ const Daemon = struct { | |
| 1140 | 1140 | ||
| 1141 | 1141 | const cmd = payload; | |
| 1142 | 1142 | ||
| 1143 | - | // Prefix the command with environment variables to prevent it from | |
| 1144 | - | // blocking. Commands run in a PTY where stdout looks like a TTY, | |
| 1145 | - | // so programs like git/man/less will open a pager and hang. We set | |
| 1146 | - | // pager-related env vars to force non-interactive behavior: | |
| 1147 | - | // PAGER=cat — default pager fallback | |
| 1148 | - | // GIT_PAGER=cat — git ignores PAGER, uses its own | |
| 1149 | - | // LESS=-F — auto-exit if content fits (catches edge cases) | |
| 1150 | - | // MANPAGER=cat — man overrides PAGER with MANPAGER | |
| 1151 | - | // COLORTERM= — disable color (avoid ANSI in output) | |
| 1152 | - | // Plus < /dev/null to prevent programs that read stdin from blocking. | |
| 1153 | - | // | |
| 1154 | - | // Commands that legitimately need stdin should use `zmx send` | |
| 1155 | - | // instead, or pipe data directly: `echo data | zmx run dev cat`. | |
| 1156 | - | const cmd_prefix = "PAGER=cat GIT_PAGER=cat LESS=-F MANPAGER=cat COLORTERM= < /dev/null "; | |
| 1157 | - | ||
| 1158 | 1143 | // Chain the exit marker with `;` on the same line. `$?` captures the | |
| 1159 | 1144 | // exit code of the command (not the `;`). The sole exception is when | |
| 1160 | - | // the command contains a heredoc (`<<`) — the delimiter must be alone | |
| 1145 | + | // the command contains a heredoc (`<<`), the delimiter must be alone | |
| 1161 | 1146 | // on its line, so the marker goes on the next line instead. | |
| 1162 | 1147 | const single_line_marker = "; echo ZMX_TASK_COMPLETED:$?\r"; | |
| 1163 | 1148 | const heredoc_marker = "\r\necho ZMX_TASK_COMPLETED:$?\r"; | |
| 1164 | 1149 | const uses_heredoc = std.mem.indexOf(u8, cmd, "<<") != null; | |
| 1165 | 1150 | ||
| 1166 | - | self.queuePtyInput(cmd_prefix); | |
| 1167 | 1151 | if (cmd.len > 0 and cmd[cmd.len - 1] == '\r') { | |
| 1168 | 1152 | self.queuePtyInput(cmd[0 .. cmd.len - 1]); | |
| 1169 | 1153 | } else { |
| ... | ... | @@ -1316,6 +1300,10 @@ fn help() !void { | |
| 1316 | 1300 | \\ zmx run dev git log --oneline # pager won't block | |
| 1317 | 1301 | \\ echo "hello" | zmx run dev cat # piped stdin still works | |
| 1318 | 1302 | \\ | |
| 1303 | + | \\ # heredoc | |
| 1304 | + | \\ printf "cat << 'EOF'\r\nHello $USER\r\nToday is $(date).\r\nEOF" | zmx run dev | |
| 1305 | + | \\ | |
| 1306 | + | \\ # non-blocking | |
| 1319 | 1307 | \\ zmx run dev -d sleep 10 | |
| 1320 | 1308 | \\ zmx wait dev | |
| 1321 | 1309 | \\ |
+2,
-1
| ... | ... | @@ -352,7 +352,8 @@ pub fn findTaskExitMarker(output: []const u8) ?u8 { | |
| 352 | 352 | ||
| 353 | 353 | /// Strip ANSI escape sequences from data, returning only printable characters | |
| 354 | 354 | /// and essential whitespace (CR, LF, tab, backspace). Uses the ghostty VT | |
| 355 | - | /// parser to correctly handle multi-byte sequences (CSI, OSC, DCS, etc.).n/// The returned slice is owned by the caller and must be freed. | |
| 355 | + | /// parser to correctly handle multi-byte sequences (CSI, OSC, DCS, etc.). | |
| 356 | + | /// The returned slice is owned by the caller and must be freed. | |
| 356 | 357 | pub fn stripAnsi(alloc: std.mem.Allocator, data: []const u8) ![]const u8 { | |
| 357 | 358 | var result = std.ArrayList(u8).initCapacity(alloc, data.len) catch unreachable; | |
| 358 | 359 | defer result.deinit(alloc); |