1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

env: change comment

This commit is contained in:
Thomas Queiroz 2021-11-02 17:23:34 -03:00
parent f9512e5a90
commit 1afc7242a5
No known key found for this signature in database
GPG key ID: 229D2DDF7ECA5F8F

View file

@ -7,7 +7,7 @@
/* last synced with: env (GNU coreutils) 8.13 */ /* last synced with: env (GNU coreutils) 8.13 */
// spell-checker:ignore (ToDO) chdir execvp progname subcommand subcommands unsets setenv putenv // spell-checker:ignore (ToDO) chdir execvp progname subcommand subcommands unsets setenv putenv posix_spawnp
#[macro_use] #[macro_use]
extern crate clap; extern crate clap;
@ -289,7 +289,12 @@ fn run_env(args: impl uucore::Args) -> UResult<()> {
// we need to execute a command // we need to execute a command
let (prog, args) = build_command(&mut opts.program); let (prog, args) = build_command(&mut opts.program);
// FIXME: this should just use execvp() (no fork()) on Unix-like systems /*
* On Unix-like systems Command::status either ends up calling either fork or posix_spawnp
* (which ends up calling clone). Keep using the current process would be ideal, but the
* standard library contains many checks and fail-safes to ensure the process ends up being
* created. This is much simpler than dealing with the hassles of calling execvp directly.
*/
match Command::new(&*prog).args(args).status() { match Command::new(&*prog).args(args).status() {
Ok(exit) if !exit.success() => return Err(exit.code().unwrap().into()), Ok(exit) if !exit.success() => return Err(exit.code().unwrap().into()),
Err(ref err) if err.kind() == io::ErrorKind::NotFound => return Err(127.into()), Err(ref err) if err.kind() == io::ErrorKind::NotFound => return Err(127.into()),