a73x

f0c3a9d9

fix: deadline line reads right from any caller, and stays two lines untty'd

a73x   2026-08-09 14:47

Commit message
fix: deadline line reads right from any caller, and stays two lines untty'd

src/spawn.zig
Old New
@@ -139,8 +139,16 @@ pub fn ensureDaemon(
139 } 139 }
140 const now = std.time.milliTimestamp(); 140 const now = std.time.milliTimestamp();
141 if (now - t0 >= deadline_ms) { 141 if (now - t0 >= deadline_ms) {
142 // The newline terminates the dot line, so it belongs to the
143 // same condition the dots do: on a non-tty there are no dots
144 // and it would only put a blank line into scripted output.
145 if (progress.tty) progress.emit("\n");
146 // "daemon", not "muxd", in the body: the prefix is the program
147 // speaking, and this same string serves the mux-side caller
148 // when auto-start lands — `mux: daemon did not answer` reads
149 // correctly, `mux: muxd did not answer` would not.
142 progress.emitFmt( 150 progress.emitFmt(
143 "\n{s}: muxd did not answer within {d}s \u{2014} log: {s}\n", 151 "{s}: daemon did not answer within {d}s \u{2014} log: {s}\n",
144 .{ progress.prefix, deadline_ms / 1000, log_path }, 152 .{ progress.prefix, deadline_ms / 1000, log_path },
145 ); 153 );
146 return error.NeverAnswered; 154 return error.NeverAnswered;
test/e2e.sh
Old New
@@ -952,6 +952,16 @@ grep -q "did not answer" "$OUT.dead" || {
952 echo "e2e FAIL: doomed start printed no deadline line"; cat "$OUT.dead"; exit 1; } 952 echo "e2e FAIL: doomed start printed no deadline line"; cat "$OUT.dead"; exit 1; }
953 grep -q "log: .*muxd\.log" "$OUT.dead" || { 953 grep -q "log: .*muxd\.log" "$OUT.dead" || {
954 echo "e2e FAIL: deadline line does not name the log"; cat "$OUT.dead"; exit 1; } 954 echo "e2e FAIL: deadline line does not name the log"; cat "$OUT.dead"; exit 1; }
955 # The failure says "daemon did not answer", never "muxd did not answer":
956 # the prefix is already the program's name, and the same line serves the
957 # mux-side caller when auto-start lands.
958 grep -q "daemon did not answer" "$OUT.dead" || {
959 echo "e2e FAIL: deadline line does not read 'daemon did not answer'"
960 cat "$OUT.dead"; exit 1; }
961 # Non-tty: exactly two lines, same as the success path. The newline that
962 # terminates the dot line is tty-only, so nothing blank creeps in here.
963 [ "$(wc -l < "$OUT.dead")" = "2" ] || {
964 echo "e2e FAIL: non-tty failure not exactly two lines:"; cat "$OUT.dead"; exit 1; }
955 rm -rf "$DEADCFG" 965 rm -rf "$DEADCFG"
956 echo "e2e OK: a start whose daemon dies young says so, with the log path" 966 echo "e2e OK: a start whose daemon dies young says so, with the log path"
957 967