This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SIGHUP on pty closure

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);

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]