commit 47fd2f8468928b88c84debfd7d2baa55e8379b58
parent be8b6609e29ed8572f9e5e63d66129a4214d5820
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 16 Jul 2020 17:23:39 +0200
pipeitem: properly signal exit status of child
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -514,7 +514,7 @@ void
pipeitem(const char *cmd, struct item *item, int wantoutput)
{
FILE *fp;
- int i, pid, wpid;
+ int i, pid, wpid, status;
if (wantoutput)
cleanup();
@@ -537,7 +537,9 @@ pipeitem(const char *cmd, struct item *item, int wantoutput)
fputs(item->fields[i], fp);
}
fputc('\n', fp);
- _exit(pclose(fp));
+ status = pclose(fp);
+ status = WIFEXITED(status) ? WEXITSTATUS(status) : 127;
+ _exit(status);
break;
default:
while ((wpid = wait(NULL)) >= 0 && wpid != pid)