-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Feature request: add method to unix::process::CommandExt to set argv[0] #66510
Copy link
Copy link
Closed
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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().