From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21039 invoked by alias); 5 Nov 2012 20:05:49 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17379 Received: (qmail 23410 invoked from network); 5 Nov 2012 20:05:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at mac.com designates 17.158.236.243 as permitted sender) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.7.7855,1.0.431,0.0.0000 definitions=2012-11-05_03:2012-11-05,2012-11-05,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=1 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1203120001 definitions=main-1211050206 Subject: Re: Commands run from functions don't exit cleanly on terminal close (SIGHUP)? From: Alan Pinstein In-reply-to: <121102001808.ZM13144@torch.brasslantern.com> Date: Mon, 05 Nov 2012 14:05:35 -0500 Message-id: <18244819-CAD8-4AA7-B46A-62C18CEC5BA3@mac.com> References: <2B813FB0-0877-42BA-974C-1A142EF09BCE@mac.com> <909858C7-4B5A-4679-90B3-6BF5398BA9FC@mac.com> <20121025112222.3dfbb213@pws-pc.ntlworld.com> <121025075455.ZM3417@torch.brasslantern.com> <121027110728.ZM8440@torch.brasslantern.com> <121028100739.ZM1724@torch.brasslantern.com> <121102001808.ZM13144@torch.brasslantern.com> To: zsh-users@zsh.org X-Mailer: Apple Mail (2.1283) > But now I think you mean > zsh -> function -> function runs ssh -> ssh runs command -> HUP zsh Yes. I am on a Mac, using iTerm. I start a new window in iTerm. It loads my zshrc which includes a function definition that wraps ssh. If I run "/usr/bin/ssh somewhere" (skipping the function) and then CLOSE the terminal window, the ssh call exits as expected and everything is great. If I run "ssh somewhere" (which ssh's from inside a function) and then CLOSE the terminal window, the ssh command does not exit, it gets orphaned (ppid=1) and never exits. This causes issues b/c I think the command loses its TTY and it ends up hosing my screen session on the other end of the ssh session. If I kill the orphaned process, screen starts working immediately again. I was able to reproduce the orphaning behavior with a PHP command so I know that it isn't some weird SSH bug. Does that help? Alan