Skip to content
Browse files

Make -L also set the controlling terminal.

  • Loading branch information...
1 parent 22b830d commit cc0c3f1a964871fa228991c63ffb5e713514f3ce @nelhage committed Aug 16, 2012
Showing with 5 additions and 1 deletion.
  1. +3 −1 reptyr.1
  2. +2 −0 reptyr.c
View
4 reptyr.1
@@ -68,7 +68,9 @@ environment variable set to the name of the slave pty. If
.B -L
is used instead of
.B -l,
-then fds 0-2 of the child will also be redirected to point to the slave.
+then fds 0-2 of the child will also be redirected to point to the
+slave, and the child will be run in a fresh session with the slave as
+its controlling terminal.
.LP
.B \-s
View
2 reptyr.c
@@ -259,6 +259,8 @@ int main(int argc, char **argv) {
setenv("REPTYR_PTY", ptsname(pty), 1);
if (unattached_script_redirection) {
int f;
+ setpgid(0, getppid());
+ setsid();
f = open(ptsname(pty), O_RDONLY, 0); dup2(f, 0); close(f);
f = open(ptsname(pty), O_WRONLY, 0); dup2(f, 1); dup2(f,2); close(f);
}

0 comments on commit cc0c3f1

Please sign in to comment.
Something went wrong with that request. Please try again.