Closed
Description
Using env_clear()
+ exec()
currently exhibits different behaviour on nightly and stable.
I believe the first nightly to regress was 2018-11-02
.
A minimal reproduction is the following code:
use std::process::Command;
use std::os::unix::process::CommandExt;
fn main() {
let mut cmd = Command::new("true");
cmd.env_clear();
let err = cmd.exec();
println!("error: {}", err);
}
On stable, it prints no error. On nightly, it prints error: No such file or directory (os error 2)
.
Using strace -e trace=execve
, we can see the difference:
# stable
execve("/bin/true", ["true"], 0x7fedf1821010 /* 0 vars */) = 0
# nightly
execve("true", ["true"], 0x561a58edbb80 /* 0 vars */) = -1 ENOENT (No such file or directory)
Meta
$ rustc --version --verbose
rustc 1.32.0-nightly (15d770400 2018-11-06)
binary: rustc
commit-hash: 15d770400eed9018f18bddf83dd65cb7789280a5
commit-date: 2018-11-06
host: x86_64-unknown-linux-gnu
release: 1.32.0-nightly
LLVM version: 8.0