ssh2-exec
Version:
Transparent usage between `child_process.exec` and `ssh2.prototype.exec`
24 lines (21 loc) • 1.2 kB
TypeScript
import * as childProcess from 'node:child_process';
import { ExecException } from 'node:child_process';
import { Client, ExecOptions as ExecOptions$1 } from 'ssh2';
declare const local: (options: ExecLocalOptions, callback: ExecCallback) => childProcess.ChildProcess;
declare const remote: (options: ExecRemoteOptions, callback: ExecCallback) => childProcess.ChildProcess;
type ExecLocalOptions = {
ssh: null | undefined;
command: string;
} & childProcess.ExecOptions;
type ExecRemoteOptions = {
ssh: Client;
command: string;
cwd?: string | undefined;
end?: boolean;
} & ExecOptions$1;
type ExecOptions = ExecLocalOptions | ExecRemoteOptions;
type ExecCallback = (err: ExecException | null, stdout: string, stderr: string, code: number) => void;
declare function exec(options: ExecOptions, callback?: ExecCallback): childProcess.ChildProcess;
declare function exec(ssh: Client | null, command: string, callback?: ExecCallback): childProcess.ChildProcess;
declare function exec(ssh: Client | null, command: string, options: ExecOptions, callback?: ExecCallback): childProcess.ChildProcess;
export { type ExecCallback, type ExecOptions, exec as default, exec, local, remote };