[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command hangs when using process substitution
From: |
Andreas Schwab |
Subject: |
Re: Command hangs when using process substitution |
Date: |
Sat, 18 Nov 2023 15:54:35 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Nov 18 2023, Greg Wooledge wrote:
> On Sat, Nov 18, 2023 at 08:36:06AM -0500, dbarrett--- via Bug reports for the
> GNU Bourne Again SHell wrote:
>> echo foo | tee >(xclip -i) | tr o x
>>
>> The command does print "fxx" but then it hangs.
>>
>> The same command behaves correctly when run in zsh.
>
> For the record, here's what processes are running on the terminal while
> it's in the "hanging" state:
>
> unicorn:~$ ps f -ft pts/28
> UID PID PPID C STIME TTY STAT TIME CMD
> greg 1082506 1082504 0 09:21 pts/28 Ss 0:00 bash
> greg 1082862 1082506 0 09:35 pts/28 S+ 0:00 \_ tr o x
> greg 1082864 1 0 09:35 pts/28 S+ 0:00 xclip -i
>
> The tee process has exited, but somehow the tr process has not --
> which must mean that tr's stdin is still open.
>
> One additional observation: if I highlight something (e.g. that ps
> output), this causes the pipeline to terminate. I assume the xclip
> process somehow notices the highlighting and exits, which causes
> tr to exit, because (presumably) it's the orphaned xclip process
> whose output was still connected to tr's input.
xclip puts itself into the background, unless it is called with -quiet
or -verbose.
-silent
fork into the background to wait for requests, no informational
output, errors only (default)
-quiet show informational messages on the terminal and run in the fore-
ground
-verbose
provide a running commentary of what xclip is doing
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."