Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Redirecting a programs job control messages to parent's STDOUT
- X-seq: zsh-users 22785
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Redirecting a programs job control messages to parent's STDOUT
- Date: Tue, 25 Jul 2017 14:03:39 -0700
- Cc: zv <zv@xxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ue2xttuFIQQFRgR3qxGEI+HOgnnKoFMIB9PeWh7D3yM=; b=yNFLxYW62KAvk2guniXi9pmmG05oyR3TeKsMNjkDYpAGAeI+tV8lvleVr49vkQ+Z2a J09zBA2gGkyMubQmHO1kktjvMVBIsp7fWc461A8OsOiZPnUhOIZaGvWiJYbnwU7jD5EP kblgDH8WW8VjMdviJOBrLNkXWT9STMrwUiSo02gIGv1mAkDWZuVwqCiMqG9MJgpg124Y eXmL/WKkaxvaLjrzqHozzExNVr9oyFVDu5djJ0XgaI9LeziIL+8yoqrg9LFSS4XfFQrl CnXhZsueYcbU/DDUdScc1A1djiFu7mGGCDTt49xhxExvUhzqZgKyGbh5r+9sFHRs/3wE KCZQ==
- In-reply-to: <ok0qqb$v09$1@blaine.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <ok0qqb$v09$1@blaine.gmane.org>
Meant to reply to this before; it got lost in the aftermath of
returning from a vacation.
On Mon, Jul 10, 2017 at 2:16 PM, zv <zv@xxxxxxxx> wrote:
> I've defined a function in my .zshrc to compile & run a file
What's going on here is that the function is considered to be running
within the current shell, so job status messages for the exit status
of the function are not printed. The exit status of the function is
the status of the last command it executed, so if you were to examine
the value of $? (or $status) after the function was done, you would
see that it reflects the failure. The lack of message has nothing to
do with how the executable or path to it was created.
So you have a couple of choices:
1. Run the command in the background so full job control applies
during the function, which is effectively what Vartan describes; or
2. Examine the exit status yourself and print your own message.
E.g. if you end your crun function with
$exepath "$@"
integer stat=$status
if (( stat > 128 )); then print -u2 -- ${exepath}: exited with
SIG${signals[stat-127]}; fi
return stat
You'll see something like
faulty.c: exited with SIGSEGV
You could also/instead "setopt print_exit_value" which would give something like
zsh: exit 139
Messages sorted by:
Reverse Date,
Date,
Thread,
Author