zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Cc: zv <zv@nxvr.org>
Subject: Re: Redirecting a programs job control messages to parent's STDOUT
Date: Tue, 25 Jul 2017 14:03:39 -0700	[thread overview]
Message-ID: <CAH+w=7ZXUVGYFXLS7rabO_4Qmbn7GwCvpnhXV_KR6NYuBGw_8Q@mail.gmail.com> (raw)
In-Reply-To: <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@nxvr.org> 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


      parent reply	other threads:[~2017-07-25 21:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 21:16 zv
2017-07-25 19:33 ` zv
2017-07-25 21:03 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7ZXUVGYFXLS7rabO_4Qmbn7GwCvpnhXV_KR6NYuBGw_8Q@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    --cc=zv@nxvr.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).