()
| 191 | let closed = false; |
| 192 | let child: ChildProcess | undefined; |
| 193 | const spawnOnce = (): void => { |
| 194 | child = spawn( |
| 195 | SSHPASS, |
| 196 | [ |
| 197 | "-p", |
| 198 | GUEST_PASS, |
| 199 | "ssh", |
| 200 | ...SSH_OPTS, |
| 201 | "-N", |
| 202 | "-L", |
| 203 | `${localPort}:127.0.0.1:${guestPort}`, |
| 204 | `${GUEST_USER}@${ip}`, |
| 205 | ], |
| 206 | { stdio: "ignore" }, |
| 207 | ); |
| 208 | child.on("exit", () => { |
| 209 | if (!closed) setTimeout(spawnOnce, 2000); |
| 210 | }); |
| 211 | }; |
| 212 | spawnOnce(); |
| 213 | const close = (): void => { |
| 214 | closed = true; |