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

Function sshInvocation

e2e/cli/custom-tools-packed.test.ts:50–64  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

48};
49
50const sshInvocation = (command: string): { command: string; args: ReadonlyArray<string> } => {
51 const host = process.env.E2E_CLI_VM_HOST;
52 if (!host) throw new Error("E2E_CLI_VM_HOST is not set");
53 const os = guestOs();
54 const wrapped =
55 os === "linux" ? `export XDG_RUNTIME_DIR=/run/user/$(id -u); ${command}` : command;
56 const keyPath = process.env.E2E_CLI_SSH_KEY;
57 const user = os === "windows" ? "Administrator" : "admin";
58 return keyPath
59 ? { command: "ssh", args: ["-i", keyPath, ...SSH_OPTS, `${user}@${host}`, wrapped] }
60 : {
61 command: process.env.E2E_SSHPASS_BIN ?? "/opt/homebrew/bin/sshpass",
62 args: ["-p", "admin", "ssh", ...SSH_OPTS, `${user}@${host}`, wrapped],
63 };
64};
65
66const ssh = async (command: string): Promise<{ stdout: string; stderr: string; code: number }> => {
67 const invocation = sshInvocation(command);

Callers 1

sshFunction · 0.70

Calls 1

guestOsFunction · 0.70

Tested by

no test coverage detected