zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: How to restore $? AND $_ ?
Date: Wed, 24 Jul 2019 08:29:08 +0200	[thread overview]
Message-ID: <CAKc7PVCyotM3UknowbpHA-yGg1Hg0ngTLEqeZjrkug9rPKE5yw@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVDqisHHAcJK06TaFmxCmmhdbYWTQUeBRsfaYu=A8xgvXA@mail.gmail.com>

False alarm – Zsh pushes the $_ values onto some kind of stack:

() { : test2 } test1; echo $_
test1

so appending $_ to the sched's argument is sufficient.

On Wed, 24 Jul 2019 at 08:20, Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> Hello,
> consider the following:
>
> sched-fun() {
>     # UND=$_
>     local ret=$?
>
>     sched +1 "sched-fun \$_"
>
>     # : $UND
>     return $ret
> }
>
> The point is that the 2 commented lines must be run in the same place
> as the next lines after them in order to work. No way out of this
> problem? It is about not disrupting user session with background
> tasks, I think that this is in general important.
> --
> Sebastian Gniazdowski
> News: https://twitter.com/ZdharmaI
> IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
> Blog: http://zdharma.org



-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

      reply	other threads:[~2019-07-24  6:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24  6:20 Sebastian Gniazdowski
2019-07-24  6:29 ` Sebastian Gniazdowski [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=CAKc7PVCyotM3UknowbpHA-yGg1Hg0ngTLEqeZjrkug9rPKE5yw@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.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).