mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
env: force specifying command with --chdir
This commit is contained in:
parent
013405d1e6
commit
8ad95c375a
1 changed files with 8 additions and 0 deletions
8
src/uu/env/src/env.rs
vendored
8
src/uu/env/src/env.rs
vendored
|
@ -229,6 +229,14 @@ fn run_env(args: impl uucore::Args) -> UResult<()> {
|
|||
}
|
||||
}
|
||||
|
||||
// GNU env tests this behavior
|
||||
if opts.program.is_empty() && running_directory.is_some() {
|
||||
return Err(UUsageError::new(
|
||||
125,
|
||||
"must specify command with --chdir (-C)".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
// NOTE: we manually set and unset the env vars below rather than using Command::env() to more
|
||||
// easily handle the case where no command is given
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue