diff options
| author | Jeffrey C. Ollie <jeff@ocjtech.us> | 2025-01-01 14:31:15 -0600 |
|---|---|---|
| committer | Jeffrey C. Ollie <jeff@ocjtech.us> | 2025-01-01 14:31:15 -0600 |
| commit | 9ea0aa49348ca653f7236636e6370abdd1b4767c (patch) | |
| tree | d340b1bb2b0c7b30f2e8ce0fc8336de859149680 /src/Command.zig | |
| parent | 60611b8a4a1d5b3c1097cce85eb0311de0696cfa (diff) | |
core: if we change RLIMIT_NOFILE, reset it when executing commands
Diffstat (limited to 'src/Command.zig')
| -rw-r--r-- | src/Command.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Command.zig b/src/Command.zig index 82b48fa18..2801def36 100644 --- a/src/Command.zig +++ b/src/Command.zig @@ -18,6 +18,7 @@ const Command = @This(); const std = @import("std"); const builtin = @import("builtin"); +const global_state = &@import("global.zig").state; const internal_os = @import("os/main.zig"); const windows = internal_os.windows; const TempDir = internal_os.TempDir; @@ -178,6 +179,10 @@ fn startPosix(self: *Command, arena: Allocator) !void { // If the user requested a pre exec callback, call it now. if (self.pre_exec) |f| f(self); + if (global_state.rlimits.nofile) |lim| { + internal_os.restoreMaxFiles(lim); + } + // Finally, replace our process. _ = posix.execveZ(pathZ, argsZ, envp) catch null; |
