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

Function sshInvocation

e2e/cli/service-install-takeover.test.ts:38–52  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

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

Callers 2

sshFunction · 0.70
startPredecessorFunction · 0.70

Calls 1

guestOsFunction · 0.70

Tested by

no test coverage detected