Date: Thu, 15 Dec 2011 03:13:23 +0000 (UTC) From: Max Khon <fjoe@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r228521 - head/usr.bin/make Message-ID: <201112150313.pBF3DNWk026878@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: fjoe Date: Thu Dec 15 03:13:23 2011 New Revision: 228521 URL: http://svn.freebsd.org/changeset/base/228521 Log: job make: if stdout is a tty create a pty when running a command. Modified: head/usr.bin/make/Makefile head/usr.bin/make/job.c Modified: head/usr.bin/make/Makefile ============================================================================== --- head/usr.bin/make/Makefile Thu Dec 15 02:26:53 2011 (r228520) +++ head/usr.bin/make/Makefile Thu Dec 15 03:13:23 2011 (r228521) @@ -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 Modified: head/usr.bin/make/job.c ============================================================================== --- head/usr.bin/make/job.c Thu Dec 15 02:26:53 2011 (r228520) +++ head/usr.bin/make/job.c Thu Dec 15 03:13:23 2011 (r228521) @@ -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 *prev 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112150313.pBF3DNWk026878>