From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20264 invoked from network); 9 Jul 2009 20:24:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 9 Jul 2009 20:24:20 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 82005 invoked from network); 9 Jul 2009 20:24:13 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 9 Jul 2009 20:24:13 -0000 Received: (qmail 17190 invoked by alias); 9 Jul 2009 20:24:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27112 Received: (qmail 17169 invoked from network); 9 Jul 2009 20:24:05 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 9 Jul 2009 20:24:05 -0000 Received: from mtaout01-winn.ispmail.ntl.com (mtaout01-winn.ispmail.ntl.com [81.103.221.47]) by bifrost.dotsrc.org (Postfix) with ESMTP id 6501780307FA for ; Thu, 9 Jul 2009 22:23:50 +0200 (CEST) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090709202350.BRQR6742.mtaout01-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Thu, 9 Jul 2009 21:23:50 +0100 Received: from pws-pc ([81.107.42.185]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090709202350.OQKC13254.aamtaout01-winn.ispmail.ntl.com@pws-pc> for ; Thu, 9 Jul 2009 21:23:50 +0100 Date: Thu, 9 Jul 2009 21:23:45 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: non-interactive set -m Message-ID: <20090709212345.05cc2213@pws-pc> In-Reply-To: References: <200907080858.n688wXfc030608@news01.csr.com> <200907081349.n68DneSv001850@news01.csr.com> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.16.2; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=9vXuR5GGAAAA:8 a=NLZqzBF-AAAA:8 a=YjaIEYUUZK7fo5yk32sA:9 a=rIxP4nbPIm-j5UVrhe8A:7 a=2xrGqDAKhmnW2lD_GFhs5L08-I8A:4 a=eDFNAWYWrCwA:10 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.94.2/9551/Thu Jul 9 15:22:08 2009 on bifrost X-Virus-Status: Clean On Thu, 9 Jul 2009 18:13:15 +0000 (UTC) Eric Blake wrote: > It looks like the fg activated the sleep process, because it took five seconds > for the Stopped message to appear, but fg failed to print to stdout > the process that it just activated. ... and the third part: this seems to be another question of testing if MONITOR is set (jobbing---I wish we didn't those #define's) but not if INTERACTIVE is set (interact). Also need to fix up the output to go to stderr instead of the file (not) opened to the terminal. I've done the same thing at another point, where the status of a job changes. You're the guinea pig so if you think this output should or shouldn't be there I can leave it or change it. As before, none of this should change the usual case where the shell is also interactive. Index: Src/jobs.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v retrieving revision 1.66 diff -u -r1.66 jobs.c --- Src/jobs.c 16 Mar 2009 05:20:36 -0000 1.66 +++ Src/jobs.c 9 Jul 2009 20:16:47 -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; + FILE *fout = (synch == 2) ? stdout : shout ? shout : stderr; if (oldjobtab != NULL) job = jn - oldjobtab; @@ -887,7 +887,7 @@ /* print if necessary: ignore option state on explicit call to `jobs'. */ if (synch == 2 || - (interact && jobbing && + (jobbing && ((jn->stat & STAT_STOPPED) || sflag || job != thisjob))) { int len2, fline = 1; /* use special format for current job, except in `jobs' */ @@ -1379,12 +1379,13 @@ setprevjob(); } else if (prevjob == -1 || !(jobtab[prevjob].stat & STAT_STOPPED)) prevjob = thisjob; - if (interact && jobbing && jobtab[thisjob].procs) { - fprintf(shout, "[%d]", thisjob); + if (jobbing && jobtab[thisjob].procs) { + FILE *fout = shout ? shout : stderr; + fprintf(fout, "[%d]", thisjob); for (pn = jobtab[thisjob].procs; pn; pn = pn->next) - fprintf(shout, " %ld", (long) pn->pid); - fprintf(shout, "\n"); - fflush(shout); + fprintf(fout, " %ld", (long) pn->pid); + fprintf(fout, "\n"); + fflush(fout); } } if (!hasprocs(thisjob)) @@ -1907,7 +1908,8 @@ 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; + FILE *fout = (func == BIN_JOBS) ? stdout : shout ? + shout : stderr; fprintf(fout, "(pwd : "); fprintdir(jobtab[job].pwd, fout); fprintf(fout, ")\n"); -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/