| 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++) { |