ctest: Set close-on-exec for jobserver FIFO

Set the close-on-exec flag to prevent the jobserver FIFO file
descriptor from leaking to subprocesses spawned by `ctest`.

This leak is usually harmless, but can cause `make test -jN` to hang
at the end of the build if a test leaves a background process running
with the jobserver FIFO file descriptor open.

Fixes: #26027
This commit is contained in:
Joan Bruguera Micó authored and Brad King committed 2024-06-05 09:37:05 -04:00
1 parent efaa9efece
commit ff077af032
1 file changed
+4
+4
View File
@@ -306,6 +306,10 @@ void ImplPosix::ConnectFIFO(const char* path)
if (fd < 0) {
return;
}
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
close(fd);
return;
}
cm::uv_pipe_ptr connFIFO;
connFIFO.init(this->Loop, 0, this);