diff --git a/Sources/Commands/SwiftRunCommand.swift b/Sources/Commands/SwiftRunCommand.swift index 0504e6c63d2..785bacea1cf 100644 --- a/Sources/Commands/SwiftRunCommand.swift +++ b/Sources/Commands/SwiftRunCommand.swift @@ -331,7 +331,7 @@ public struct SwiftRunCommand: AsyncSwiftCommand { #if !os(Windows) // Dispatch will disable almost all asynchronous signals on its worker threads, and this is called from `async` // context. To correctly `exec` a freshly built binary, we will need to: - // 1. reset the signal masks + // 1. Reset the signal masks for i in 1..= from { + _ = fcntl(fd, F_SETFD, FD_CLOEXEC) + } + } + return + } + } + + let numFDs = sysconf(Int32(_SC_OPEN_MAX)) + for fd in from..