|
26 | 26 | # If the MAKEFLAGS variable contains multiple instances of the
|
27 | 27 | # --jobserver-auth= option, the last one is relevant.
|
28 | 28 | fds = opts[-1].split("=", 1)[1]
|
29 |
| - reader, writer = [int(x) for x in fds.split(",", 1)] |
30 |
| - # Open a private copy of reader to avoid setting nonblocking |
31 |
| - # on an unexpecting process with the same reader fd. |
32 |
| - reader = os.open("/proc/self/fd/%d" % (reader), |
33 |
| - os.O_RDONLY | os.O_NONBLOCK) |
| 29 | + |
| 30 | + # Starting with GNU Make 4.4, named pipes are used for reader and writer. |
| 31 | + # Example argument: --jobserver-auth=fifo:/tmp/GMfifo8134 |
| 32 | + _, _, path = fds.partition('fifo:') |
| 33 | + |
| 34 | + if path: |
| 35 | + reader = os.open(path, os.O_RDONLY | os.O_NONBLOCK) |
| 36 | + writer = os.open(path, os.O_WRONLY) |
| 37 | + else: |
| 38 | + reader, writer = [int(x) for x in fds.split(",", 1)] |
| 39 | + # Open a private copy of reader to avoid setting nonblocking |
| 40 | + # on an unexpecting process with the same reader fd. |
| 41 | + reader = os.open("/proc/self/fd/%d" % (reader), |
| 42 | + os.O_RDONLY | os.O_NONBLOCK) |
34 | 43 |
|
35 | 44 | # Read out as many jobserver slots as possible.
|
36 | 45 | while True:
|
|
0 commit comments