This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
tcgetpgrp
- From: Andy Koppe <andy dot koppe at gmail dot com>
- To: cygwin-developers at cygwin dot com
- Date: Thu, 8 Oct 2009 07:34:28 +0100
- Subject: tcgetpgrp
I'm having trouble with this change:
* fhandler_termios.cc (fhandler_termios::tcgetpgrp): Only return
valid pgid if tty is controlling tty. Set errno to ENOTTY and
return -1 otherwise.
Mintty uses the following call to create its pty:
openpty (&parent_fd, &child_fd, 0, 0, winp)
It then forks a child process which calls login_tty(child_fd) and
execs the shell or other command. Meanwhile, the parent mintty process
retains the child_fd, so that it can find out what the current
foreground process of the pty is, using tcgetpgrp(child_fd).
/proc/<id>/cwd then allows it to find the current working directory of
the foreground process.
This is used for a new feature in mintty-0.5: Ctrl+clicking on a file
to open it via cygstart, whereby the current working directory of the
foreground process is needed for relative paths. This worked fine up
to 1.7.0-62, but due to the change above it no longer works on
cygwin-cvs.
Is it really necessary to restrict tcgetpgrp() in that way? Is there
any other way to find the current foreground process of a terminal?
Andy