summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-run-shell.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-03-21 13:15:38 +0000
committernicm <nicm@openbsd.org>2020-03-21 13:15:38 +0000
commitb372330d53c2b3e1ab70d1215758ed7506128d3c (patch)
treecf3369b869e8dd07a2bcc80d11ba24a28c663f43 /usr.bin/tmux/cmd-run-shell.c
parentAdd clock support for i.MX8MM. The CCM is based on the i.MX8MQ version, (diff)
downloadwireguard-openbsd-b372330d53c2b3e1ab70d1215758ed7506128d3c.tar.xz
wireguard-openbsd-b372330d53c2b3e1ab70d1215758ed7506128d3c.zip
Preserve exit status from run-shell and pass to the client.
Diffstat (limited to 'usr.bin/tmux/cmd-run-shell.c')
-rw-r--r--usr.bin/tmux/cmd-run-shell.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c
index 65dac3d6d4d..f9eea21b9cd 100644
--- a/usr.bin/tmux/cmd-run-shell.c
+++ b/usr.bin/tmux/cmd-run-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-run-shell.c,v 1.62 2020/03/19 13:43:18 nicm Exp $ */
+/* $OpenBSD: cmd-run-shell.c,v 1.63 2020/03/21 13:15:38 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -160,6 +160,7 @@ cmd_run_shell_callback(struct job *job)
{
struct cmd_run_shell_data *cdata = job_get_data(job);
struct bufferevent *event = job_get_event(job);
+ struct cmdq_item *item = cdata->item;
char *cmd = cdata->cmd, *msg = NULL, *line;
size_t size;
int retcode, status;
@@ -189,13 +190,17 @@ cmd_run_shell_callback(struct job *job)
} else if (WIFSIGNALED(status)) {
retcode = WTERMSIG(status);
xasprintf(&msg, "'%s' terminated by signal %d", cmd, retcode);
+ retcode += 128;
}
if (msg != NULL)
cmd_run_shell_print(job, msg);
free(msg);
- if (cdata->item != NULL)
- cmdq_continue(cdata->item);
+ if (item != NULL) {
+ if (item->client != NULL && item->client->session == NULL)
+ item->client->retval = retcode;
+ cmdq_continue(item);
+ }
}
static void