Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Frozen command substitution
- X-seq: zsh-users 28912
- From: Dominik Vogt <dominik.vogt@xxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Frozen command substitution
- Date: Sat, 11 Feb 2023 10:41:07 +0100
- Archived-at: <https://zsh.org/users/28912>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: Zsh Users <zsh-users@xxxxxxx>
- Reply-to: zsh-users@xxxxxxx
- Ui-outboundreport: notjunk:1;M01:P0:f7sIe+CbiHI=;d89H+v5t1oZg4aXZa0LAjROQTDI Y7QqRrWyKbWTAe66db6ouN0HHOy642rmedsCA3IPgoJ382xSboWQj4nVHsdsRv2OtXMGH+gqy WVaPYMatJwWkQRiVFhNfwNF3hxc2Mck52I14znXFGY6ed4RcICcpOgLCVNPpe78VMmYMAKThC gKXI2uJL5RqgUaHd97SeNDnzVFaAKe+V1q0iNcjYXWV3BxxpgDu2Wm2CIEz136Tp1A8/j9jCM cYUxVkayhstpDRt60jNjBSXvKyYGUfMsD+YVZru/iSJGiL3m7fduN4Vf3i7sGOBaH49wOgY1+ r0s0gxy6IHJboZsBRQj1sCqSw2nA3C9NOo0158S8IKVPkvTs1EQZNtLxDJRc8usEvif93SC6p kG4oNp+7PLj3GWzzTZmc5/7cwk7gchYwVK2f21yBqif6nm1SbfiJOCrfPPeA8p2H6vCUWTNfz F10mgITGfFFyv4VFQ756DwoNLxh/uWMcesBARktpPqeuHAdme9N02N8TIWsZSYbSxmtYBiUqj GE/+9SgH76zonQenoSURTTB2Xmuqqkw026XafLjSQJbt70DPw35DwNvMDGn1z9VsuAxdVQI8D Eq8Iai6WH9I8HbAdj0boDMu4KwWZ7ilZIVnP3VXXe/8Ojjq9ihUSA+Sw5+pR0J20JYx8pIp63 hqQwv894gLLQhfFFu432Pza8Usyzg3meZ7idhl6ReLqaAx5e7nXH5N/qOX5uFridPSL54dUQs g6VjsKZ+koW1a/w5g1KWzqBogZQu8LS+SIlvlnhCrXIiacCCNNDbtIgasBwu7RPFOemMPEvgp IvdR54IyphxwpBcVU7rvIFNMk2m515S5IGZFQdIkNlQbbwFAn3TN1nO1nW/mV8Jz43CltCWKZ 9QnCkFHRHSI5dsAiQdv2TiLrJa9CG1rT1lrYbwa7ta4WbscLw9rNgc2A35PwPvdts0aEsbG+o /vSyJQ==
I have two long running scripts that do complex interaction with
the web browser, say "foo" which calls the subordinate script
"bar". The browser crashes once in a while and is restarted
automatically by some other script. Sometimes when this happens,
foo freezes in a call of bar and won't wake up anymore when bar
terminates:
-- foo --
while true; do
some-func
test some-condition && break
done
some-func () {
while true; do
R="$(bar ssome arguments)" <------- hangs in this line
test some condition && return 0
done
}
-- foo --
-- bar --
# some long-running loop
# ...
return 0
-- bar --
Ciao
Dominik ^_^ ^_^
--
So, foo calls bar in a loop. While bar is running, the browser is
restarted. bar detects this, finishes and exits with the "return
0". However, foo does not continue with the line after the
command substitution. A "ctrl-z" foollowed by "fg" does not help.
Sending it SIGUSR1 (which has a trap installed) wakes it up again.
In the process list:
$ pstree -a
...
<terminal>-+-zsh-+-foo
|-tee
+-zsh
(The whole stuff is calles with
"while true; do foo 2>&1 | tee foo.out; done".) /proc/<pid>/status says:
$ cat /proc/<pid>/status
...
State: S (sleeping)
Tgid: 13030
Ngid: 0
Pid: 13030
PPid: 24927
...
foo has a trap for "HUP" installed, and that's being called when
when I type "killall -HUP foo", so the shell is not dead. "ps"
lists the processes' status as "S+".
Dominik Vogt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author