From 3803da525cbfc9e5c89b4a8f953ac82a74cf075a Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 13 Nov 2010 05:05:48 -0800 Subject: [PATCH] Notice sooner when make has "helpfully" closed its job control file descriptors. --- Makefile | 2 +- jwack.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e705521..4eb5943 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: %: FORCE - ./redo $@ + +./redo $@ .PHONY: FORCE diff --git a/jwack.py b/jwack.py index 00df9be..9016db2 100755 --- a/jwack.py +++ b/jwack.py @@ -65,6 +65,14 @@ def setup(maxjobs): b = _atoi(b) if a <= 0 or b <= 0: raise ValueError('invalid --jobserver-fds: %r' % arg) + try: + fcntl.fcntl(a, fcntl.F_GETFL) + fcntl.fcntl(b, fcntl.F_GETFL) + except IOError, e: + if e.errno == errno.EBADF: + raise ValueError('broken --jobserver-fds from make; prefix your Makefile rule with a "+"') + else: + raise _fds = (a,b) if maxjobs and not _fds: # need to start a new server @@ -81,7 +89,7 @@ def wait(want_token): if _fds and want_token: rfds.append(_fds[0]) r,w,x = select.select(rfds, [], []) - #print 'readable: %r' % r + _debug('_fds=%r; wfds=%r; readable: %r\n' % (_fds, _waitfds, r)) for fd in r: if _fds and fd == _fds[0]: pass