=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-run-shell.c,v retrieving revision 1.53 retrieving revision 1.54 diff -c -r1.53 -r1.54 *** src/usr.bin/tmux/cmd-run-shell.c 2018/05/24 09:42:49 1.53 --- src/usr.bin/tmux/cmd-run-shell.c 2018/08/23 15:45:05 1.54 *************** *** 1,4 **** ! /* $OpenBSD: cmd-run-shell.c,v 1.53 2018/05/24 09:42:49 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha --- 1,4 ---- ! /* $OpenBSD: cmd-run-shell.c,v 1.54 2018/08/23 15:45:05 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha *************** *** 57,63 **** static void cmd_run_shell_print(struct job *job, const char *msg) { ! struct cmd_run_shell_data *cdata = job->data; struct window_pane *wp = NULL; struct cmd_find_state fs; --- 57,63 ---- static void cmd_run_shell_print(struct job *job, const char *msg) { ! struct cmd_run_shell_data *cdata = job_get_data(job); struct window_pane *wp = NULL; struct cmd_find_state fs; *************** *** 113,134 **** static void cmd_run_shell_callback(struct job *job) { ! struct cmd_run_shell_data *cdata = job->data; ! char *cmd = cdata->cmd, *msg, *line; size_t size; ! int retcode; do { ! if ((line = evbuffer_readline(job->event->input)) != NULL) { cmd_run_shell_print(job, line); free(line); } } while (line != NULL); ! size = EVBUFFER_LENGTH(job->event->input); if (size != 0) { line = xmalloc(size + 1); ! memcpy(line, EVBUFFER_DATA(job->event->input), size); line[size] = '\0'; cmd_run_shell_print(job, line); --- 113,135 ---- static void cmd_run_shell_callback(struct job *job) { ! struct cmd_run_shell_data *cdata = job_get_data(job); ! struct bufferevent *event = job_get_event(job); ! char *cmd = cdata->cmd, *msg = NULL, *line; size_t size; ! int retcode, status; do { ! if ((line = evbuffer_readline(event->input)) != NULL) { cmd_run_shell_print(job, line); free(line); } } while (line != NULL); ! size = EVBUFFER_LENGTH(event->input); if (size != 0) { line = xmalloc(size + 1); ! memcpy(line, EVBUFFER_DATA(event->input), size); line[size] = '\0'; cmd_run_shell_print(job, line); *************** *** 136,147 **** free(line); } ! msg = NULL; ! if (WIFEXITED(job->status)) { ! if ((retcode = WEXITSTATUS(job->status)) != 0) xasprintf(&msg, "'%s' returned %d", cmd, retcode); ! } else if (WIFSIGNALED(job->status)) { ! retcode = WTERMSIG(job->status); xasprintf(&msg, "'%s' terminated by signal %d", cmd, retcode); } if (msg != NULL) --- 137,148 ---- free(line); } ! status = job_get_status(job); ! if (WIFEXITED(status)) { ! if ((retcode = WEXITSTATUS(status)) != 0) xasprintf(&msg, "'%s' returned %d", cmd, retcode); ! } else if (WIFSIGNALED(status)) { ! retcode = WTERMSIG(status); xasprintf(&msg, "'%s' terminated by signal %d", cmd, retcode); } if (msg != NULL)