pub struct Command { /* private fields */ }
Expand description
A command to be spawned.
Implementations§
Source§impl Command
impl Command
Sourcepub fn new(prog: &str) -> Self
pub fn new(prog: &str) -> Self
Creates a new command to be spawned.
prog
should be the path to the program being spawned. If prog
does not contain
a /
, then it will be searched in PATH
similar to how a shell would do it.
The first argument passed to prog
, argv[0]
, is prog
itself.
Sourcepub fn env(&mut self, key: &str, val: &str) -> &mut Self
pub fn env(&mut self, key: &str, val: &str) -> &mut Self
Sets an environment variable for this command only.
Sourcepub fn fd<F: Into<OwnedFd>>(&mut self, idx: i32, fd: F) -> &mut Self
pub fn fd<F: Into<OwnedFd>>(&mut self, idx: i32, fd: F) -> &mut Self
Sets a file descriptor of the process.
By default, the process starts with exactly stdin, stdout, and stderr open and all
pointing to /dev/null
.
Sourcepub fn stdin<F: Into<OwnedFd>>(&mut self, fd: F) -> &mut Self
pub fn stdin<F: Into<OwnedFd>>(&mut self, fd: F) -> &mut Self
Sets the stdin of the process.
This is equivalent to fd(0, fd)
.
Sourcepub fn stdout<F: Into<OwnedFd>>(&mut self, fd: F) -> &mut Self
pub fn stdout<F: Into<OwnedFd>>(&mut self, fd: F) -> &mut Self
Sets the stdout of the process.
This is equivalent to fd(1, fd)
.
Sourcepub fn stderr<F: Into<OwnedFd>>(&mut self, fd: F) -> &mut Self
pub fn stderr<F: Into<OwnedFd>>(&mut self, fd: F) -> &mut Self
Sets the stderr of the process.
This is equivalent to fd(2, fd)
.
Sourcepub fn privileged(&mut self) -> &mut Self
pub fn privileged(&mut self) -> &mut Self
Runs the application with access to privileged wayland protocols.
The default is false
.
Auto Trait Implementations§
impl !Freeze for Command
impl !RefUnwindSafe for Command
impl Send for Command
impl !Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more