delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/07/21/17:43:49

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4E289D7B.4050103@gmail.com>
Date: Thu, 21 Jul 2011 23:43:23 +0200
From: Marco atzeri <marco DOT atzeri AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0
MIME-Version: 1.0
To: cygwin <cygwin AT cygwin DOT com>
Subject: SIGHUP on pty closure
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

looking on the mc subshell issue, I found that mc
suppose that the subshell will receive a SIGHUP
when mc exit and close the master side of pty.

Is such assumption wrong or it is a missing piece of
cygwin pty implementation ?



------------- extract from subshell.c --------------
     /* Attach all our standard file descriptors to the pty */

     /* This is done just before the fork, because stderr must still      */
     /* be connected to the real tty during the above error messages; */
     /* otherwise the user will never see them.                   */

     dup2 (subshell_pty_slave, STDIN_FILENO);
     dup2 (subshell_pty_slave, STDOUT_FILENO);
     dup2 (subshell_pty_slave, STDERR_FILENO);

     close (subshell_pipe[READ]);
     close (subshell_pty_slave); /* These may be FD_CLOEXEC, but just in 
case... */
     /* Close master side of pty.  This is important; apart from */
     /* freeing up the descriptor for use in the subshell, it also       */
     /* means that when MC exits, the subshell will get a SIGHUP and     */
     /* exit too, because there will be no more descriptors pointing     */
     /* at the master side of the pty and so it will disappear.  */
     close (subshell_pty);

     /* Execute the subshell at last */

     switch (subshell_type)
     {
     case BASH:
         execl (shell, "bash", "-rcfile", init_file, (char *) NULL);
         break;
----------------------------------------------------------

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019