zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: suspend (^Z) behavior while a function is running is unclear
Date: Mon, 20 Feb 2012 10:53:01 -0800	[thread overview]
Message-ID: <120220105301.ZM436@torch.brasslantern.com> (raw)
In-Reply-To: <20120220183335.GE7797@xvii.vinc17.org>

On Feb 20,  7:33pm, Vincent Lefevre wrote:
} Subject: Re: suspend (^Z) behavior while a function is running is unclear
}
} > torch% foreach foo (a b c) { sleep 5 } | :  
} > zsh: job can't be suspended
} 
} However if the command outputs something, one loses the output.

I didn't really mean to imply that you should use this, just that some
of the plumbing is in place if we wanted to provide direct control.

On the other hand:

foreach foo (a b c) { print $foo; sleep 5 } | while { read -rE } { : }

(Using shortloops syntax to emphasize zsh-ness of this trick.)
 
} But with the encapsulation (to save typing), this is very limited.

As a hack, one could do:

    alias -g NOSUSP='|while { read -rE } { : }'

    foreach foo (a b c) { print $foo; sleep 5 } NOSUSP

This is similar to the "alias -g M='|more'" trick that I know a number
of people have used at one time or another.


  reply	other threads:[~2012-02-20 18:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20 13:02 Vincent Lefevre
2012-02-20 15:13 ` Peter Stephenson
2012-02-20 16:09   ` Vincent Lefevre
2012-02-20 16:35     ` Peter Stephenson
2012-02-20 17:41       ` Bart Schaefer
2012-02-20 18:33         ` Vincent Lefevre
2012-02-20 18:53           ` Bart Schaefer [this message]
2012-02-20 19:21             ` Vincent Lefevre
2012-02-20 19:48             ` Mikael Magnusson
2012-02-21  3:27               ` Bart Schaefer

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=120220105301.ZM436@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).