From a25ab95a036223f5cc7a802a70f86e10547c70d9 Mon Sep 17 00:00:00 2001 From: fjoe Date: Thu, 15 Dec 2011 03:13:23 +0000 Subject: job make: if stdout is a tty create a pty when running a command. --- usr.bin/make/Makefile | 2 ++ usr.bin/make/job.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile index 2dc7e583..773f5e3 100644 --- a/usr.bin/make/Makefile +++ b/usr.bin/make/Makefile @@ -7,6 +7,8 @@ CFLAGS+=-I${.CURDIR} SRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \ lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \ util.c var.c +DPADD= ${LIBUTIL} +LDADD= -lutil NO_SHARED?= YES 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 #include #include +#include #include #include #include @@ -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); -- cgit v1.1