Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make -L also set the controlling terminal.

  • Loading branch information...
commit cc0c3f1a964871fa228991c63ffb5e713514f3ce 1 parent 22b830d
Nelson Elhage authored August 16, 2012

Showing 2 changed files with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  reptyr.1
  2. 2  reptyr.c
4  reptyr.1
@@ -68,7 +68,9 @@ environment variable set to the name of the slave pty. If
68 68
 .B -L
69 69
 is used instead of
70 70
 .B -l,
71  
-then fds 0-2 of the child will also be redirected to point to the slave.
  71
+then fds 0-2 of the child will also be redirected to point to the
  72
+slave, and the child will be run in a fresh session with the slave as
  73
+its controlling terminal.
72 74
 .LP
73 75
 
74 76
 .B \-s
2  reptyr.c
@@ -259,6 +259,8 @@ int main(int argc, char **argv) {
259 259
                 setenv("REPTYR_PTY", ptsname(pty), 1);
260 260
                 if (unattached_script_redirection) {
261 261
                     int f;
  262
+                    setpgid(0, getppid());
  263
+                    setsid();
262 264
                     f = open(ptsname(pty), O_RDONLY, 0); dup2(f, 0);            close(f);
263 265
                     f = open(ptsname(pty), O_WRONLY, 0); dup2(f, 1); dup2(f,2); close(f);
264 266
                 }

0 notes on commit cc0c3f1

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