SSH
public class SSH
SSH Connection This class automatically manages a connection pool to run multiple commands at the same time
-
Initialize the SSH Connection class
Note
At this moment no SSH connection is activeDeclaration
Swift
public init(options: SSHOption)Parameters
optionsOptions required for a SSH connection
-
disconnect()AsynchronousDisconnect the underlying SSH pool
Declaration
Swift
public func disconnect() async -
exec(command:Asynchronous) Execute a command in the SSH connection pool
Declaration
Swift
public func exec(command: String) async throws -> SSHExecResultParameters
commandCommand to execute on the remote host
Return Value
SSHExecResultcontaining the result of the execution -
exec(command:Asynchronousdelegate: notCancelable: ) Execute a command in the SSH connection pool
Declaration
Swift
public func exec(command: String, delegate: SSHExecDelegate?, notCancelable: Bool = false) async throws -> SSHExecResultParameters
commandCommand to execute on the remote host
delegateEvents like
SSHExecDelegate.onStdoutorSSHExecDelegate.onStderrget called on this object. This can provide realtime featuresnotCancelableIf this is true, the required command wrapper which is needed for
cancel(id:)doesn’t get add. This parameter is optional and normally you should leave it aloneReturn Value
SSHExecResult containing the result of the execution
-
cancel(id:Asynchronous) Cancel a command on the remote machine
Warning
If the ssh pool is satisfied, this function doesn’t return until a connection gets freed upDeclaration
Swift
public func cancel(id: String) async throwsParameters
idId of the command which gets passed in the
SSHExecDelegate.cancelFunctionmethod of theSSHExecDelegateinexec(command:delegate:notCancelable:)
SSH Class Reference