Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: non-interactive set -m
- X-seq: zsh-workers 27119
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: non-interactive set -m
- Date: Fri, 10 Jul 2009 09:58:13 +0100
- In-reply-to: <loom.20090709T212555-863@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <loom.20090707T205334-50@xxxxxxxxxxxxxx> <200907080858.n688wXfc030608@xxxxxxxxxxxxxx> <loom.20090708T124251-758@xxxxxxxxxxxxxx> <200907081349.n68DneSv001850@xxxxxxxxxxxxxx> <loom.20090709T170937-567@xxxxxxxxxxxxxx> <20090709212345.05cc2213@pws-pc> <loom.20090709T212555-863@xxxxxxxxxxxxxx>
On Thu, 9 Jul 2009 21:40:19 +0000 (UTC)
Eric Blake <ebb9@xxxxxxx> wrote:
> POSIX states that fg output goes to stdout, not stderr.
>...
> It looks like two different sources of noise - creating the background task is
> outputting information about the job just created, which should really be
> conditional on being interactive (a non-interactive shell will use 'jobs' to
> learn this information, rather than having it printed to stderr). The
> other source of noise is that fg is writing to stderr instead of the
> required stdout.
It looks like you didn't want the other "if (interact)" removing. This
should fix these two.
> Also, POSIX states that fg output should be the name of the command that was
> brought into the foreground, and not the 'jobs' output describing that
> command.
Haven't looked at this, but as an annoying fiddly difference it probably
needs to be an option.
Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.67
diff -u -r1.67 jobs.c
--- Src/jobs.c 9 Jul 2009 20:33:56 -0000 1.67
+++ Src/jobs.c 10 Jul 2009 08:56:26 -0000
@@ -828,7 +828,7 @@
int job, len = 9, sig, sflag = 0, llen;
int conted = 0, lineleng = columns, skip = 0, doputnl = 0;
int doneprint = 0;
- FILE *fout = (synch == 2) ? stdout : shout ? shout : stderr;
+ FILE *fout = (synch == 2 || !shout) ? stdout : shout;
if (oldjobtab != NULL)
job = jn - oldjobtab;
@@ -886,8 +886,8 @@
/* print if necessary: ignore option state on explicit call to `jobs'. */
- if (synch == 2 ||
- (jobbing &&
+ if (synch == 2 ||
+ (interact && jobbing &&
((jn->stat & STAT_STOPPED) || sflag || job != thisjob))) {
int len2, fline = 1;
/* use special format for current job, except in `jobs' */
@@ -1380,7 +1380,7 @@
} else if (prevjob == -1 || !(jobtab[prevjob].stat & STAT_STOPPED))
prevjob = thisjob;
if (jobbing && jobtab[thisjob].procs) {
- FILE *fout = shout ? shout : stderr;
+ FILE *fout = shout ? shout : stdout;
fprintf(fout, "[%d]", thisjob);
for (pn = jobtab[thisjob].procs; pn; pn = pn->next)
fprintf(fout, " %ld", (long) pn->pid);
@@ -1908,8 +1908,7 @@
printjob(jobtab + job, (stopped) ? -1 : lng, 1);
if (func != BIN_BG) { /* fg or wait */
if (jobtab[job].pwd && strcmp(jobtab[job].pwd, pwd)) {
- FILE *fout = (func == BIN_JOBS) ? stdout : shout ?
- shout : stderr;
+ FILE *fout = (func == BIN_JOBS || !shout) ? stdout : shout;
fprintf(fout, "(pwd : ");
fprintdir(jobtab[job].pwd, fout);
fprintf(fout, ")\n");
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author