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

Re: fg call in function: bug?



"Matt Wozniski" <mjw452@xxxxxxxxxx> wrote:
> If I run 'fg %n' with a job number that doesn't exist, it has
> different (and worse) effects in a function than at a prompt.  (Sorry
> if this has been fixed in CVS... Ubuntu Dapper doesn't have a package
> past 4.2.5 yet.. ;) )

I think this is most easily fixed by telling the code to ignore jobs in the
current shell for the purpose of job control; they're fictions to make
special effects easier.  I can't offhand see this is going to cause any
problems, but we'll just have to see.  Certainly you wouldn't expect to
be able to do job control on them.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.104
diff -u -r1.104 exec.c
--- Src/exec.c	17 Sep 2006 19:28:46 -0000	1.104
+++ Src/exec.c	6 Nov 2006 12:18:31 -0000
@@ -2265,7 +2265,7 @@
 	/* This is a current shell procedure that didn't need to fork.    *
 	 * This includes current shell procedures that are being exec'ed, *
 	 * as well as null execs.                                         */
-	jobtab[thisjob].stat |= STAT_CURSH;
+	jobtab[thisjob].stat |= STAT_CURSH|STAT_NOPRINT;
     } else {
 	/* This is an exec (real or fake) for an external command.    *
 	 * Note that any form of exec means that the subshell is fake *



To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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