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

PATCH: Don't STTY if you can't use it



When the STTY variable was in the enviroment, background jobs or any other
job that wasn't allowed to read/write the terminal would stop on SIGTTIN,
often silently because their parent wasn't doing job control.

This patch makes STTY apply only to process group leaders.  That may be a
bit too extreme, but it seems to do the right thing in every case I tried.
Better ideas welcome.

Index: Src/exec.c
===================================================================
@@ -458,7 +458,8 @@
     /* If the parameter STTY is set in the command's environment, *
      * we first run the stty command with the value of this       *
      * parameter as it arguments.                                 */
-    if (!exargs && (s = zgetenv("STTY")) && isatty(0)) {
+    if (!exargs && (s = zgetenv("STTY")) && isatty(0) &&
+	(GETPGRP() == getpid())) {
 	char *t;
 
 	exargs = args;	/* this prevents infinite recursion */

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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