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

Capturing "jobs" output.



I have noticed some unexpected behavior in the "jobs" builtin.  It is
possible to redirect its output to a file, but any piping of any sort
fails miserably.  Note these examples:

---------------------------------
% jobs
[1]  + suspended (tty input)  cat
[2]    running    sig-updater
% jobs > foo.tmp
% cat foo.tmp
[1]  + suspended (tty input)  cat
[2]    running    sig-updater
% jobs | cat
% echo $(jobs)
% cat <(jobs)
% cat =(jobs)
---------------------------------

I found the "cat =(jobs)" lack of output especially surprising, since I
would expect it to be equivalent to "jobs > /tmp/xxx ; cat /tmp/xxx". 
Clearly, at some point, the output is not being redirected, or maybe is
not being printed at all.  I looked through the source of builtins.c
and jobs.c, but the "fout" variable seems to check out OK.  I'm not
familiar with Zsh internals, but I'd guess that one of those nested
if's in printjob() (jobs.c) is filtering out the redirections before
anything is printed.  I can work around it for now by just using a temp
file, but could someone look into this?

Thanks,

--Xris

-- 
... that whenever any form of government becomes destructive of these
ends, it is the right of the people to alter or to abolish it, and to
institute new government, laying its foundation on such principles,
and organizing its powers in such form, as to them shall seem most
likely to effect their safety and happiness.
    -- Thomas Jefferson, Prologue, "Declaration of Independence"

{ Chris "Xris" Laas }----{ chrisl@xxxxxxxxxxxx }----{ xris@xxxxxxx }




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