updated on Sat Jan 14 00:11:12 UTC 2012
[aur-mirror.git] / sbcl-run-program-fix / run-program.diff
blob96ef43272536a075c371833528fca2a009b768d9
1 diff --git a/src/runtime/run-program.c b/src/runtime/run-program.c
2 index 77a93d5..d1d98e6 100644
3 --- a/src/runtime/run-program.c
4 +++ b/src/runtime/run-program.c
5 @@ -65,16 +65,22 @@ int spawn(char *program, char *argv[], int sin, int sout, int serr,
6 if (pid != 0)
7 return pid;
9 - /* Put us in our own process group. */
10 + /* Put us in our own process group, but only if we need not
11 + * share stdin with our parent. In the latter case we claim
12 + * control of the terminal. */
13 + if (sin >= 0) {
14 #if defined(LISP_FEATURE_HPUX)
15 - setsid();
16 + setsid();
17 #elif defined(LISP_FEATURE_DARWIN)
18 - setpgid(0, getpid());
19 + setpgid(0, getpid());
20 #elif defined(SVR4) || defined(__linux__) || defined(__osf__)
21 - setpgrp();
22 + setpgrp();
23 #else
24 - setpgrp(0, getpid());
25 + setpgrp(0, getpid());
26 #endif
27 + } else {
28 + tcsetpgrp(0, getpgrp());
29 + }
31 /* unblock signals */
32 sigemptyset(&sset);