pub type Command<'s> = OwningCommand<&'s Session>;
Expand description
Convenience OwningCommand
alias when working with a session reference.
Aliased Type§
struct Command<'s> { /* private fields */ }
Implementations
Source§impl<S> OwningCommand<S>
impl<S> OwningCommand<S>
Sourcepub fn arg<A: AsRef<str>>(&mut self, arg: A) -> &mut Self
pub fn arg<A: AsRef<str>>(&mut self, arg: A) -> &mut Self
Adds an argument to pass to the remote program.
Before it is passed to the remote host, arg
is escaped so that special characters aren’t
evaluated by the remote shell. If you do not want this behavior, use
raw_arg
.
Only one argument can be passed per use. So instead of:
.arg("-C /path/to/repo")
usage would be:
.arg("-C")
.arg("/path/to/repo")
To pass multiple arguments see args
.
Sourcepub fn raw_arg<A: AsRef<OsStr>>(&mut self, arg: A) -> &mut Self
pub fn raw_arg<A: AsRef<OsStr>>(&mut self, arg: A) -> &mut Self
Adds an argument to pass to the remote program.
Unlike arg
, this method does not shell-escape arg
. The argument is passed as written
to ssh
, which will pass it again as an argument to the remote shell. Since the remote
shell may do argument parsing, characters such as spaces and *
may be interpreted by the
remote shell.
To pass multiple unescaped arguments see raw_args
.
Sourcepub fn raw_args<I, A>(&mut self, args: I) -> &mut Self
pub fn raw_args<I, A>(&mut self, args: I) -> &mut Self
Adds multiple arguments to pass to the remote program.
Unlike args
, this method does not shell-escape args
. The arguments are passed as
written to ssh
, which will pass them again as arguments to the remote shell. However,
since the remote shell may do argument parsing, characters such as spaces and *
may be
interpreted by the remote shell.
To pass a single argument see raw_arg
.
Source§impl<S: Clone> OwningCommand<S>
impl<S: Clone> OwningCommand<S>
Sourcepub async fn spawn(&mut self) -> Result<Child<S>, Error>
pub async fn spawn(&mut self) -> Result<Child<S>, Error>
Executes the remote command without waiting for it, returning a handle to it instead.
By default, stdin, stdout and stderr are inherited.
Sourcepub async fn output(&mut self) -> Result<Output, Error>
pub async fn output(&mut self) -> Result<Output, Error>
Executes the remote command, waiting for it to finish and collecting all of its output.
By default, stdout and stderr are captured (and used to provide the resulting
output) and stdin is set to Stdio::null()
.
Sourcepub async fn status(&mut self) -> Result<ExitStatus, Error>
pub async fn status(&mut self) -> Result<ExitStatus, Error>
Executes the remote command, waiting for it to finish and collecting its exit status.
By default, stdin, stdout and stderr are inherited.