* background job status update
@ 2009-03-14 8:18 Atom Smasher
2009-03-14 17:26 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Atom Smasher @ 2009-03-14 8:18 UTC (permalink / raw)
To: zsh-users
if i start a job in the background such as:
sleep 30 &
i get a status report sent to stderr as expected:
[1] 1234
but when the job exits, i get this to my terminal:
[1] + done sleep 30
i would expect both of those messages to be sent to stderr. why is the
second message sent to my terminal? how can i direct it to stderr?
tested with zsh 4.3.6.
thanks...
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"A computer lets you make more mistakes faster
than any invention in human history - with the
possible exceptions of handguns and tequila."
-- Mitch Ratliffe, Technology Review, April, 1992
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: background job status update
2009-03-14 8:18 background job status update Atom Smasher
@ 2009-03-14 17:26 ` Bart Schaefer
2009-03-14 18:40 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2009-03-14 17:26 UTC (permalink / raw)
To: zsh-users
On Mar 14, 9:18pm, Atom Smasher wrote:
} Subject: background job status update
}
} if i start a job in the background such as:
} sleep 30 &
} i get a status report sent to stderr as expected:
} [1] 1234
} but when the job exits, i get this to my terminal:
} [1] + done sleep 30
}
} i would expect both of those messages to be sent to stderr.
Funny, I'd expect both to be sent to the terminal.
The problem is that spawnjob() doesn't go through printjob() to format
the output of "[1] 1234" (silly aside: as I was testing this, process
IDs on my machine passed through "12345") and instead simply writes
directly to stderr. I think at the very least it should be using the
special shout (shell output) file pointer, which is what printjob()
does during all job control operations thereafter.
I'm not sure why it doesn't just use printjob(); probably historic from
when both of those functions were simpler.
} why is the
} second message sent to my terminal? how can i direct it to stderr?
You can't.
All you can do is suppress it by unsetopt monitor or by starting the
background job in a subshell, or delay it by unsetopt notify.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: background job status update
2009-03-14 17:26 ` Bart Schaefer
@ 2009-03-14 18:40 ` Peter Stephenson
0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2009-03-14 18:40 UTC (permalink / raw)
Cc: zsh-users
On Sat, 14 Mar 2009 10:26:18 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> The problem is that spawnjob() doesn't go through printjob() to format
> the output of "[1] 1234" (silly aside: as I was testing this, process
> IDs on my machine passed through "12345") and instead simply writes
> directly to stderr. I think at the very least it should be using the
> special shout (shell output) file pointer, which is what printjob()
> does during all job control operations thereafter.
We might as well put that right. Note that printjob() uses stdout if
it's for a command where the user has requested a status output; that
doesn't seem to apply here.
> I'm not sure why it doesn't just use printjob(); probably historic from
> when both of those functions were simpler.
printjob() doesn't currently do the right thing even if called at that
point. There's no reason it couldn't, but I doubt if the result would
be a code saving or a clarification.
> } why is the
> } second message sent to my terminal? how can i direct it to stderr?
>
> You can't.
... the point being this is *interactive* job control based around a
terminal session. It's not a general purpose mini-process-management
system.
Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.64
diff -u -r1.64 jobs.c
--- Src/jobs.c 31 Jul 2008 08:44:21 -0000 1.64
+++ Src/jobs.c 14 Mar 2009 18:36:05 -0000
@@ -1380,11 +1380,11 @@
} else if (prevjob == -1 || !(jobtab[prevjob].stat & STAT_STOPPED))
prevjob = thisjob;
if (interact && jobbing && jobtab[thisjob].procs) {
- fprintf(stderr, "[%d]", thisjob);
+ fprintf(shout, "[%d]", thisjob);
for (pn = jobtab[thisjob].procs; pn; pn = pn->next)
- fprintf(stderr, " %ld", (long) pn->pid);
- fprintf(stderr, "\n");
- fflush(stderr);
+ fprintf(shout, " %ld", (long) pn->pid);
+ fprintf(shout, "\n");
+ fflush(shout);
}
}
if (!hasprocs(thisjob))
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-14 18:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-14 8:18 background job status update Atom Smasher
2009-03-14 17:26 ` Bart Schaefer
2009-03-14 18:40 ` Peter Stephenson
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).