mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-30 00:00:16 +02:00
process: add arg0 method to Command (#3984)
This commit is contained in:
@@ -551,6 +551,7 @@ impl Command {
|
||||
///
|
||||
/// [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
|
||||
#[cfg(windows)]
|
||||
#[cfg_attr(docsrs, doc(cfg(windows)))]
|
||||
pub fn creation_flags(&mut self, flags: u32) -> &mut Command {
|
||||
self.std.creation_flags(flags);
|
||||
self
|
||||
@@ -560,6 +561,7 @@ impl Command {
|
||||
/// `setuid` call in the child process. Failure in the `setuid`
|
||||
/// call will cause the spawn to fail.
|
||||
#[cfg(unix)]
|
||||
#[cfg_attr(docsrs, doc(cfg(unix)))]
|
||||
pub fn uid(&mut self, id: u32) -> &mut Command {
|
||||
self.std.uid(id);
|
||||
self
|
||||
@@ -568,11 +570,26 @@ impl Command {
|
||||
/// Similar to `uid` but sets the group ID of the child process. This has
|
||||
/// the same semantics as the `uid` field.
|
||||
#[cfg(unix)]
|
||||
#[cfg_attr(docsrs, doc(cfg(unix)))]
|
||||
pub fn gid(&mut self, id: u32) -> &mut Command {
|
||||
self.std.gid(id);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set executable argument
|
||||
///
|
||||
/// Set the first process argument, `argv[0]`, to something other than the
|
||||
/// default executable path.
|
||||
#[cfg(unix)]
|
||||
#[cfg_attr(docsrs, doc(cfg(unix)))]
|
||||
pub fn arg0<S>(&mut self, arg: S) -> &mut Command
|
||||
where
|
||||
S: AsRef<OsStr>,
|
||||
{
|
||||
self.std.arg0(arg);
|
||||
self
|
||||
}
|
||||
|
||||
/// Schedules a closure to be run just before the `exec` function is
|
||||
/// invoked.
|
||||
///
|
||||
@@ -603,6 +620,7 @@ impl Command {
|
||||
/// working directory have successfully been changed, so output to these
|
||||
/// locations may not appear where intended.
|
||||
#[cfg(unix)]
|
||||
#[cfg_attr(docsrs, doc(cfg(unix)))]
|
||||
pub unsafe fn pre_exec<F>(&mut self, f: F) -> &mut Command
|
||||
where
|
||||
F: FnMut() -> io::Result<()> + Send + Sync + 'static,
|
||||
|
||||
Reference in New Issue
Block a user