summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 5a2037cf..ba67766d 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -609,11 +609,13 @@ pub const Kill = struct {
const names = std.mem.trim(u8, c.arg orelse "", " \t\r\n");
var stopped = false;
var jobless = false;
+ var running = false;
for (c.p.panes, 0..) |slot, id| {
const pane = slot orelse continue;
// A command pane's child is the command: the whole of its
// process group goes, as acme's Kill ends the process.
if (pane.command) |line| if (!pane.command_done) {
+ running = true;
const said = std.mem.trim(u8, line, " \t");
const first = said[0 .. std.mem.indexOfAny(u8, said, " \t") orelse said.len];
if (names.len > 0) {
@@ -627,6 +629,7 @@ pub const Kill = struct {
continue;
};
if (!panes.terminal.commandRunning(pane)) continue;
+ running = true;
const sent = pane.sent_command.?;
if (names.len > 0) {
var words = std.mem.tokenizeAny(u8, names, " \t");
@@ -640,9 +643,11 @@ pub const Kill = struct {
}
if (stopped) return;
if (jobless) return c.p.reportFailure(c.id, "Kill: no job to signal (its shell runs it without job control)");
- if (names.len > 0)
+ // Said, but no failure: a script's Kill, named or not, has nothing
+ // left to do. Only commands running, none of them the one named, is.
+ if (names.len > 0 and running)
c.p.reportFailure(c.id, "Kill: no running command has that first word")
- else // said, but no failure: a script's Kill has nothing left to do
+ else
c.p.setMessage(c.id, "Kill: nothing running");
}
};