mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
env: handle -
correctly again
This commit is contained in:
parent
d6753d8914
commit
b0c200e831
2 changed files with 7 additions and 3 deletions
6
src/uu/env/src/env.rs
vendored
6
src/uu/env/src/env.rs
vendored
|
@ -227,7 +227,11 @@ fn run_env(args: impl uucore::Args) -> UResult<()> {
|
||||||
// read NAME=VALUE arguments (and up to a single program argument)
|
// read NAME=VALUE arguments (and up to a single program argument)
|
||||||
while !begin_prog_opts {
|
while !begin_prog_opts {
|
||||||
if let Some(opt) = iter.next() {
|
if let Some(opt) = iter.next() {
|
||||||
begin_prog_opts = parse_name_value_opt(&mut opts, opt)?;
|
if opt == "-" {
|
||||||
|
opts.ignore_env = true;
|
||||||
|
} else {
|
||||||
|
begin_prog_opts = parse_name_value_opt(&mut opts, opt)?;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,8 +120,8 @@ fn test_multiple_name_value_pairs() {
|
||||||
fn test_ignore_environment() {
|
fn test_ignore_environment() {
|
||||||
let scene = TestScenario::new(util_name!());
|
let scene = TestScenario::new(util_name!());
|
||||||
|
|
||||||
scene.ucmd().arg("-i").run().no_stdout();
|
scene.ucmd().arg("-i").succeeds().no_stdout();
|
||||||
scene.ucmd().arg("-").run().no_stdout();
|
scene.ucmd().arg("-").succeeds().no_stdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue