@@ -14,7 +14,8 @@ const description_fmt =
1414 "Run a bash command and return its combined output.\n\n" ++
1515 "The command runs with `bash -c` starting in {s}, your working directory. Use it for " ++
1616 "builds, tests, git, package managers, and other file work. The output ends " ++
17- "with an `exit code:` line. Pass `timeout` (seconds) to change the 120-second limit.";
17+ "with an `exit code:` line, or `killed: timed out after Ns` if it hits the time limit. " ++
18+ "Pass `timeout` (seconds) to change the 120-second limit.";
1819
1920 const params = [_]tools.Param{
2021 .{ .name = "command", .kind = .string, .description = "Bash command line to execute." },
@@ -164,22 +165,21 @@ pub fn run(a: std.mem.Allocator, scratch: std.mem.Allocator, args_json: []const
164165 .exited => |c| c,
165166 else => null,
166167 };
167- const label: []const u8 = if (timed_out)
168- std.fmt.allocPrint(scratch, "timed out after {d}s", .{timeout_s}) catch "timed out"
168+ const status: []const u8 = if (timed_out)
169+ std.fmt.allocPrint(scratch, "killed: timed out after {d}s", .{timeout_s}) catch "killed: timed out"
169170 else if (code) |c|
170- std.fmt.allocPrint(scratch, "{d}", .{c}) catch "unknown"
171+ std.fmt.allocPrint(scratch, "exit code: {d}", .{c}) catch "exit code: unknown"
171172 else if (cancelled)
172- "aborted"
173+ "exit code: aborted"
173174 else
174- "unknown";
175+ "exit code: unknown";
175176
176177 const raw_body = acc.body(scratch) catch return fail(a, "bash failed: out of memory", .{});
177178 const body = text.utf8Clean(scratch, raw_body) catch return fail(a, "bash failed: out of memory", .{});
178179 var out: std.ArrayList(u8) = .empty;
179180 out.appendSlice(a, body) catch return fail(a, "bash failed: out of memory", .{});
180181 if (body.len > 0 and body[body.len - 1] != '\n') out.append(a, '\n') catch return fail(a, "bash failed: out of memory", .{});
181- out.appendSlice(a, std.fmt.allocPrint(scratch, "exit code: {s}", .{label}) catch "exit code: unknown") catch
182- return fail(a, "bash failed: out of memory", .{});
182+ out.appendSlice(a, status) catch return fail(a, "bash failed: out of memory", .{});
183183
184184 if (ctx.on_phase) |p| p.call(.snapshotting);
185185 const after = snapshot.capture(scratch, ignore) catch return fail(a, "bash failed: out of memory", .{});