Add std::os::unix::process::CommandExt::chroot
to safely chroot a child process by joshtriplett · Pull Request #137759 · rust-lang/rust (original) (raw)
This adds a chroot
method to the CommandExt
extension trait for theCommand
builder, to set a directory to chroot into. This will chroot
the child process into that directory right before calling chdir for theCommand
's working directory.
To avoid allowing a process to have a working directory outside of the
chroot, if the Command
does not yet have a working directory set,chroot
will set its working directory to "/".
This PR currently has the tracking issue set to "none"; if the ACP is approved,
I'll file a tracking issue and update the PR.