X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Frun-program.c;h=d1d98e63503ed0057ab3c3a9e79cad0c66818803;hb=922fe0d6da0e4bdcd366f5101395670aabd14e62;hp=77a93d54facdb6ed58047cce1a0773f2bd777935;hpb=7b849c5d91184f7bb9d3407802a1d3aadda85f39;p=sbcl.git diff --git a/src/runtime/run-program.c b/src/runtime/run-program.c index 77a93d5..d1d98e6 100644 --- a/src/runtime/run-program.c +++ b/src/runtime/run-program.c @@ -65,16 +65,22 @@ int spawn(char *program, char *argv[], int sin, int sout, int serr, if (pid != 0) return pid; - /* Put us in our own process group. */ + /* Put us in our own process group, but only if we need not + * share stdin with our parent. In the latter case we claim + * control of the terminal. */ + if (sin >= 0) { #if defined(LISP_FEATURE_HPUX) - setsid(); + setsid(); #elif defined(LISP_FEATURE_DARWIN) - setpgid(0, getpid()); + setpgid(0, getpid()); #elif defined(SVR4) || defined(__linux__) || defined(__osf__) - setpgrp(); + setpgrp(); #else - setpgrp(0, getpid()); + setpgrp(0, getpid()); #endif + } else { + tcsetpgrp(0, getpgrp()); + } /* unblock signals */ sigemptyset(&sset);