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

Re: Weird test failures under Cygwin



On May 10,  9:38pm, Andrej Borsenkow wrote:
}
} Something has changed in the way zpty runs commands

The thing that changed about the way zpty runs commands is, zsh forks
and then the subshell then runs the command on the pty.  This allows you
to run shell functions, loops, pipelines, etc. on the pty rather than
running only a single simple external command.

} Look here:
} 
}       PID    PPID    PGID     WINPID TTY  UID    STIME COMMAND
}      3140    2216    3140       3140   1 1006 21:30:23 /usr/bin/zsh
}      2412    3140    2412       2696   1 1006 21:30:24 /usr/bin/zsh
} 
} The tty0 is my current and tty1 is pts; when I unload zpty (test does
} it) it basically sends HUP to tty group - but we have *two* tty groups
} here.

Here's what I get on linux ("ps j" output):

 PPID   PID  PGID   SID TTY TPGID  STAT  UID   TIME COMMAND
 3646  3657  3657  3612  pc  4149  S      11   0:00 zsh-4.0.1-pre-4 
 3657  3684  3684  3684  a0  3685  S      11   0:00 zsh-4.0.1-pre-4 
 3684  3685  3685  3684  a0  3685  S      11   0:00 zsh-4.0.1-pre-4 

3684 is the forked subshell, and 3685 is the external command.  You can
see this better if I use "zpty bash bash":

 PPID   PID  PGID   SID TTY TPGID  STAT  UID   TIME COMMAND
 3646  3657  3657  3612  pc  4149  S      11   0:00 zsh-4.0.1-pre-4 
 3657  4147  4147  4147  a0  4148  S      11   0:00 zsh-4.0.1-pre-4 
 4147  4148  4148  4147  a0  4148  S      11   0:00 bash 

Note that there are two process groups, but only one controlling tty
process group ... but whichever one I send a HUP to, they both exit.

In your case, the subshell is hanging around even though the command
it was running has exited.  That's not supposed to happen; even if the
subshell didn't get the SIGHUP, it should get the SIGCHLD and realize
it has no more reason to live.

} So the second zsh is stuck around with Test/comp.tmp as current dir

You can eliminate the subshell in comptest with the patch below, but it
would be good to find out what that subshell is waiting around for in
the general case.

Index: Test/comptest
===================================================================
--- Test/comptest	2001/05/09 04:42:14	1.2
+++ Test/comptest	2001/05/11 08:08:00
@@ -18,7 +18,7 @@
   (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
 
   export PS1="<PROMPT>"
-  zpty zsh "$comptest_zsh -f +Z"
+  zpty zsh "exec $comptest_zsh -f +Z"
 
   zpty -r zsh log1 "*<PROMPT>*" || { 
     print "first prompt hasn't appeared."

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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