In Unix, the first process argument is the executable name by convention. However, there are various occasions where you might want to set argv[0] to something other than the full executable path:
- to set a normalized program name
- to put multiple functions into one executable, selected by argv[0]
- to put commentary on the execution context for a process
- etc
I suggest adding a set_argv_0<S: AsRef<OsStr>(&mut self, arg: S) -> process::Command to std::os::unix::process::CommandExt to allow argv[0] to be overridden.
The default behaviour would remain unchanged.
It would require a little more implementation change - currently it always executes self.get_argv()[0], but this should be changed to self.program.as_ptr().
In Unix, the first process argument is the executable name by convention. However, there are various occasions where you might want to set argv[0] to something other than the full executable path:
I suggest adding a
set_argv_0<S: AsRef<OsStr>(&mut self, arg: S) -> process::Commandtostd::os::unix::process::CommandExtto allow argv[0] to be overridden.The default behaviour would remain unchanged.
It would require a little more implementation change - currently it always executes
self.get_argv()[0], but this should be changed toself.program.as_ptr().