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

Function sshInvocation

e2e/cli/election-cold-start.test.ts:37–51  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

35};
36
37const sshInvocation = (command: string): { command: string; args: ReadonlyArray<string> } => {
38 const host = process.env.E2E_CLI_VM_HOST;
39 if (!host) throw new Error("E2E_CLI_VM_HOST is not set");
40 const os = guestOs();
41 const wrapped =
42 os === "linux" ? `export XDG_RUNTIME_DIR=/run/user/$(id -u); ${command}` : command;
43 const keyPath = process.env.E2E_CLI_SSH_KEY;
44 const user = os === "windows" ? "Administrator" : "admin";
45 return keyPath
46 ? { command: "ssh", args: ["-i", keyPath, ...SSH_OPTS, `${user}@${host}`, wrapped] }
47 : {
48 command: process.env.E2E_SSHPASS_BIN ?? "/opt/homebrew/bin/sshpass",
49 args: ["-p", "admin", "ssh", ...SSH_OPTS, `${user}@${host}`, wrapped],
50 };
51};
52
53const ssh = async (command: string): Promise<{ stdout: string; stderr: string; code: number }> => {
54 const invocation = sshInvocation(command);

Callers 1

sshFunction · 0.70

Calls 1

guestOsFunction · 0.70

Tested by

no test coverage detected