Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 2x 2x 2x 2x 2x 2x | import { execa } from 'execa';
import type { Logger } from '../utils/logger.js';
export type ExecResult = { stdout: string; stderr: string };
export interface ISshService {
runRemote(command: string): Promise<ExecResult>;
}
/**
* SSH into a Salesforce Workspace via workspaces-config.
* Invocation: ssh -F <config> <SFW_ALIAS> "<command>"
*/
export class SshService implements ISshService {
constructor(
private readonly sshConfigFile: string,
private readonly host: string,
private readonly logger: Logger,
) {}
async runRemote(command: string): Promise<ExecResult> {
this.logger.info(`ssh ${this.host}: ${command.slice(0, 120)}${command.length > 120 ? '…' : ''}`);
const result = await execa('ssh', ['-F', this.sshConfigFile, this.host, command]);
return { stdout: result.stdout, stderr: result.stderr };
}
}
|