diff options
| author | Jeremy Fitzhardinge <jeremy@goop.org> | 2019-11-17 22:56:13 -0800 |
|---|---|---|
| committer | Jeremy Fitzhardinge <jsgf@fb.com> | 2019-11-19 11:01:52 -0800 |
| commit | 6dee1a5a9f0e5a85ac294c7473c247e33b63284c (patch) | |
| tree | 5b83f12570bea1b09ce9d53b56798dd2b5c28a04 /src/libstd/sys/unix/process/process_unix.rs | |
| parent | 361791bb5fdd714bdc39f8af835f6468dd18331d (diff) | |
| download | rust-6dee1a5a9f0e5a85ac294c7473c247e33b63284c.tar.gz rust-6dee1a5a9f0e5a85ac294c7473c247e33b63284c.zip | |
Add unix::process::CommandExt::arg0
This allows argv[0] to be overridden on the executable's command-line. This also makes the program executed independent of argv[0]. Does Fuchsia have the same semantics? Addresses: #66510
Diffstat (limited to 'src/libstd/sys/unix/process/process_unix.rs')
| -rw-r--r-- | src/libstd/sys/unix/process/process_unix.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index 507dc689261..45e4d195f17 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -248,7 +248,7 @@ impl Command { *sys::os::environ() = envp.as_ptr(); } - libc::execvp(self.get_argv()[0], self.get_argv().as_ptr()); + libc::execvp(self.get_program().as_ptr(), self.get_argv().as_ptr()); Err(io::Error::last_os_error()) } @@ -373,7 +373,7 @@ impl Command { .unwrap_or_else(|| *sys::os::environ() as *const _); let ret = libc::posix_spawnp( &mut p.pid, - self.get_argv()[0], + self.get_program().as_ptr(), file_actions.0.as_ptr(), attrs.0.as_ptr(), self.get_argv().as_ptr() as *const _, |
