Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

multios and unnecessary processes



Hi, I would expect:

zsh -c 'lsof -ag $$ -d0-2,10-15 >&2 >&- >&2'

and 

zsh -c 'lsof -ag $$ -d0-2,10-15 >&2'

To work the same. However, in the first case, I get:

~$ zsh -c 'lsof -ag $$ -d0-2,10-15 >&2 >&- >&2'
~$ COMMAND  PID PGID     USER   FD   TYPE DEVICE SIZE  NODE NAME                                                                          16:39
lsof    7684 7684 chazelas    0u   CHR  136,6          8 /dev/pts/6
lsof    7684 7684 chazelas    1w  FIFO    0,7      21985 pipe
lsof    7684 7684 chazelas    2u   CHR  136,6          8 /dev/pts/6
zsh     7685 7684 chazelas   13u   CHR  136,6          8 /dev/pts/6
zsh     7685 7684 chazelas   14r  FIFO    0,7      21985 pipe

(note that my prompt is displayed before the result of lsof
because the output is written by that background zsh process).

In the second case, I get the expected behavior:

~$ zsh -c 'lsof -ag $$ -d0-2,10-15 >&2'
COMMAND  PID PGID     USER   FD   TYPE DEVICE SIZE NODE NAME
lsof    7702 7702 chazelas    0u   CHR  136,6         8 /dev/pts/6
lsof    7702 7702 chazelas    1u   CHR  136,6         8 /dev/pts/6
lsof    7702 7702 chazelas    2u   CHR  136,6         8 /dev/pts/6


I came accross this while trying to make some code independant
of the multios setting (hence the >&- to cancel the teed
redirection).

~$ zsh -f
% zmodload zsh/parameter
% echo $options[multios]
on

I'm not too sure it's a good idea to make multios the default.

-- 
Stéphane



Messages sorted by: Reverse Date, Date, Thread, Author