diff options
author | fjoe <fjoe@FreeBSD.org> | 2011-12-15 03:13:23 +0000 |
---|---|---|
committer | fjoe <fjoe@FreeBSD.org> | 2011-12-15 03:13:23 +0000 |
commit | a25ab95a036223f5cc7a802a70f86e10547c70d9 (patch) | |
tree | 8eda5fce994e4033f8032ae0a5b49373905962a3 /usr.bin/make/job.c | |
parent | 51d47afd851057c0e847d4c9ceadf0b00685bc20 (diff) | |
download | FreeBSD-src-a25ab95a036223f5cc7a802a70f86e10547c70d9.zip FreeBSD-src-a25ab95a036223f5cc7a802a70f86e10547c70d9.tar.gz |
job make: if stdout is a tty create a pty when running a command.
Diffstat (limited to 'usr.bin/make/job.c')
-rw-r--r-- | usr.bin/make/job.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 75f7949..179306f 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include <fcntl.h> #include <inttypes.h> #include <limits.h> +#include <libutil.h> #include <paths.h> #include <string.h> #include <signal.h> @@ -1798,8 +1799,13 @@ JobStart(GNode *gn, int flags, Job *previous) if (usePipes) { int fd[2]; - if (pipe(fd) == -1) - Punt("Cannot create pipe: %s", strerror(errno)); + if (isatty(1)) { + if (openpty(fd + 1, fd + 0, NULL, NULL, NULL) == -1) + Punt("Cannot open pty: %s", strerror(errno)); + } else { + if (pipe(fd) == -1) + Punt("Cannot create pipe: %s", strerror(errno)); + } job->inPipe = fd[0]; job->outPipe = fd[1]; fcntl(job->inPipe, F_SETFD, 1); |