mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 04:57:45 +00:00
Merge pull request #622 from himikof/fix-env
Fix `env -` option handling case
This commit is contained in:
commit
0bbefa913e
2 changed files with 9 additions and 1 deletions
2
src/env/env.rs
vendored
2
src/env/env.rs
vendored
|
@ -116,7 +116,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
}
|
||||
}
|
||||
} else if opt.starts_with("-") {
|
||||
if opt.len() == 0 {
|
||||
if opt.len() == 1 {
|
||||
// implies -i and stop parsing opts
|
||||
wait_cmd = true;
|
||||
opts.ignore_env = true;
|
||||
|
|
|
@ -35,6 +35,14 @@ fn test_ignore_environment() {
|
|||
|
||||
let out = str::from_utf8(&po.stdout[..]).unwrap();
|
||||
assert_eq!(out, "");
|
||||
|
||||
let po = Command::new(PROGNAME)
|
||||
.arg("-")
|
||||
.output()
|
||||
.unwrap_or_else(|err| panic!("{}", err));
|
||||
|
||||
let out = str::from_utf8(&po.stdout[..]).unwrap();
|
||||
assert_eq!(out, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue