From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: Re: Using "source" in a function breaks job control
Date: Wed, 22 Apr 2015 22:26:27 +0100 [thread overview]
Message-ID: <20150422222627.1f6154e9@ntlworld.com> (raw)
In-Reply-To: <5537E450.9060205@thequod.de>
On Wed, 22 Apr 2015 20:11:28 +0200
Daniel Hahler <genml+zsh-workers@thequod.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I've noticed that when using "source" (with a file that has at least
> one expression) in a function, it will cause job control to not work
> as expected anymore.
>
> TEST CASE:
> 1. echo true > /tmp/foo.zsh
> 2. vi() { source /tmp/foo.zsh; vim -u NONE -N; }
> 3. Run "vi"
> 4. In Vim, press Ctrl-Z to put it into the background.
> 5. Execute "fg".
>
> It should bring back "vim", but does not.
I'm not going to get any further with this tonight, but using a build to
instrument process group handling I posted a few weeks ago it seems that
in the failing case the terminal doesn't get reattached to the vim
process when the shell function is brought to the foreground.
I've omitted irrelevant detail, in particular attaching to the main
interactive shell process.
In the successful case,
+10:11% vi() { vim -u NONE -N; }
+10:11% vi
Attaching TTY 10 to 20919
[1] + 20922 suspended vi
(148)+[1]10:11% ps -fp 20922
UID PID PPID C STIME TTY TIME CMD
pws 20922 20794 0 22:11 pts/1 00:00:00 ./zsh
+[1]10:12% ps -fp 20919
UID PID PPID C STIME TTY TIME CMD
pws 20919 20794 0 22:11 pts/1 00:00:00 vim -u NONE -N
+[1]10:12% fg
[1] + 20922 continued vi
Attaching TTY 10 to 20919
Attaching TTY 10 to 20922
I suspect but haven't checked that final attachtty is after the vim
exited successfully (which you can't see happening).
In the failing case,
+10:12% vi() { . /tmp/foo.zsh; vim -u NONE -N; }
+10:13% vi
Attaching TTY 10 to 21065
[1] + 21068 running
(148)+[1]10:13% ps -fp 21068
UID PID PPID C STIME TTY TIME CMD
pws 21068 20794 0 22:13 pts/1 00:00:00 ./zsh
+[1]10:13% ps -fp 21065
UID PID PPID C STIME TTY TIME CMD
pws 21065 20794 0 22:13 pts/1 00:00:00 vim -u NONE -N
+[1]10:13% fg
[1] + 21068 continued
Attaching TTY 10 to 21068
There's no attachtty to 21065. Handling of SIGCONT within the subshell?
pws
next prev parent reply other threads:[~2015-04-22 21:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 18:11 Daniel Hahler
2015-04-22 20:41 ` Peter Stephenson
2015-04-22 21:26 ` Peter Stephenson [this message]
2015-04-23 4:55 ` Bart Schaefer
2015-04-23 20:13 ` Peter Stephenson
2015-04-24 6:22 ` Bart Schaefer
2015-04-24 15:25 ` Peter Stephenson
2015-04-24 15:43 ` Peter Stephenson
2015-04-24 16:21 ` Bart Schaefer
2015-04-27 17:29 ` Peter Stephenson
2015-04-28 10:18 ` Peter Stephenson
2015-04-28 15:57 ` 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=20150422222627.1f6154e9@ntlworld.com \
--to=p.w.stephenson@ntlworld.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).