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

Function ssh

e2e/desktop-vm/custom-tools-sidecar.test.ts:57–76  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

55const token = (): string => (os === "linux" ? "desktop-linux-e2e" : "desktop-macos-e2e");
56
57const ssh = async (command: string): Promise<{ stdout: string; stderr: string; code: number }> => {
58 if (!guestIp) throw new Error("E2E_DESKTOP_VM_IP is not set");
59 const wrapped =
60 os === "linux" ? `export XDG_RUNTIME_DIR=/run/user/$(id -u); ${command}` : command;
61 try {
62 const { stdout, stderr } = await execFileAsync(
63 process.env.E2E_SSHPASS_BIN ?? "/opt/homebrew/bin/sshpass",
64 ["-p", "admin", "ssh", ...SSH_OPTS, `admin@${guestIp}`, wrapped],
65 { maxBuffer: 64 * 1024 * 1024 },
66 );
67 return { stdout, stderr, code: 0 };
68 } catch (error) {
69 const err = error as { stdout?: string; stderr?: string; code?: number };
70 return {
71 stdout: err.stdout ?? "",
72 stderr: err.stderr ?? "",
73 code: typeof err.code === "number" ? err.code : 1,
74 };
75 }
76};
77
78const fixturePath = (slug: string): string =>
79 os === "linux"

Callers 3

writeFixtureFunction · 0.70
removeFixtureFunction · 0.70
guestRequestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected