| ... | @@ -421,16 +421,6 @@ pub const ChildProcess = struct { | ... | @@ -421,16 +421,6 @@ pub const ChildProcess = struct { |
| 421 | } | 421 | } |
| 422 | | 422 | |
| 423 | if (self.cwd_dir) |cwd| { | 423 | if (self.cwd_dir) |cwd| { |
| 424 | // Remove the O_CLOEXEC flag. This is the only safe time to do it, between fork() and execve(). | | |
| 425 | var flags = os.fcntl(cwd.fd, os.F_GETFD, 0) catch |err| switch (err) { | | |
| 426 | error.Locked => unreachable, | | |
| 427 | else => |e| forkChildErrReport(err_pipe[1], e), | | |
| 428 | }; | | |
| 429 | flags &= ~@as(u32, os.O_CLOEXEC); | | |
| 430 | _ = os.fcntl(cwd.fd, os.F_SETFD, flags) catch |err| switch (err) { | | |
| 431 | error.Locked => unreachable, | | |
| 432 | else => |e| forkChildErrReport(err_pipe[1], e), | | |
| 433 | }; | | |
| 434 | os.fchdir(cwd.fd) catch |err| forkChildErrReport(err_pipe[1], err); | 424 | os.fchdir(cwd.fd) catch |err| forkChildErrReport(err_pipe[1], err); |
| 435 | } else if (self.cwd) |cwd| { | 425 | } else if (self.cwd) |cwd| { |
| 436 | os.chdir(cwd) catch |err| forkChildErrReport(err_pipe[1], err); | 426 | os.chdir(cwd) catch |err| forkChildErrReport(err_pipe[1], err); |