MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / ssh

Function ssh

e2e/src/vm/tart.ts:136–152  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

134 os === "linux" ? `export XDG_RUNTIME_DIR=/run/user/$(id -u); ${command}` : command;
135
136 const ssh = async (command: string): Promise<SshResult> => {
137 try {
138 const { stdout, stderr } = await execFileP(
139 SSHPASS,
140 ["-p", GUEST_PASS, "ssh", ...SSH_OPTS, `${GUEST_USER}@${ip}`, wrap(command)],
141 { maxBuffer: 32 * 1024 * 1024 },
142 );
143 return { stdout, stderr, code: 0 };
144 } catch (err) {
145 const e = err as { stdout?: string; stderr?: string; code?: number };
146 return {
147 stdout: e.stdout ?? "",
148 stderr: e.stderr ?? "",
149 code: typeof e.code === "number" ? e.code : 1,
150 };
151 }
152 };
153
154 const waitSsh = async (attempts: number): Promise<boolean> => {
155 for (let i = 0; i < attempts; i++) {

Callers 2

waitSshFunction · 0.70
tartVmFunction · 0.70

Calls 1

wrapFunction · 0.70

Tested by

no test coverage detected