[][src]Struct spurs::ssh::SshShell

pub struct SshShell { /* fields omitted */ }

Represents a connection via SSH to a particular source.

Methods

impl SshShell
[src]

pub fn with_default_key<A: ToSocketAddrs + Debug>(
    username: &str,
    remote: A
) -> Result<Self, Error>
[src]

Returns a shell connected via the default private key at $HOME/.ssh/id_rsa to the given SSH server as the given user.

This example is not tested
SshShell::with_default_key("markm", "myhost:22")?;

pub fn with_key<A: ToSocketAddrs + Debug, P: AsRef<Path>>(
    username: &str,
    remote: A,
    key: P
) -> Result<Self, Error>
[src]

Returns a shell connected via private key file key to the given SSH server as the given user.

This example is not tested
SshShell::with_key("markm", "myhost:22", "/home/foo/.ssh/id_rsa")?;

pub fn toggle_dry_run(&mut self)
[src]

Toggles dry run mode. In dry run mode, commands are not executed remotely; we only print what commands we would execute. Note that we do connect remotely, though. This is off by default: we default to actually running the commands.

Trait Implementations

impl Execute for SshShell
[src]

type SshSpawnHandle = SshSpawnHandle

fn run(&self, cmd: SshCommand) -> Result<SshOutput, Error>
[src]

Run a command on the remote machine, blocking until the command completes.

Note that command using sudo will hang indefinitely if sudo asks for a password.

fn spawn(&self, cmd: SshCommand) -> Result<SshSpawnHandle, Error>
[src]

Run a command on the remote machine, without blocking until the command completes. A handle is returned, which one can join on to wait for process completion.

Note that command using sudo will hang indefinitely if sudo asks for a password.

fn reconnect(&mut self) -> Result<(), Error>
[src]

Attempt to reconnect to the remote until it reconnects (possibly indefinitely).

Auto Trait Implementations

impl Send for SshShell

impl Sync for SshShell

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]