( token: string, )
| 3 | import { waitUntilUrlIsNotResponding } from "./helpers"; |
| 4 | |
| 5 | export const startWorkspaceProxy = async ( |
| 6 | token: string, |
| 7 | ): Promise<ChildProcess> => { |
| 8 | const cp = spawn(coderBinary, ["wsproxy", "server"], { |
| 9 | env: { |
| 10 | ...process.env, |
| 11 | CODER_PRIMARY_ACCESS_URL: `http://127.0.0.1:${coderPort}`, |
| 12 | CODER_PROXY_SESSION_TOKEN: token, |
| 13 | CODER_HTTP_ADDRESS: `localhost:${workspaceProxyPort}`, |
| 14 | }, |
| 15 | }); |
| 16 | cp.stdout.on("data", (data: Buffer) => { |
| 17 | console.info( |
| 18 | `[wsproxy] [stdout] [onData] ${data.toString().replace(/\n$/g, "")}`, |
| 19 | ); |
| 20 | }); |
| 21 | cp.stderr.on("data", (data: Buffer) => { |
| 22 | console.info( |
| 23 | `[wsproxy] [stderr] [onData] ${data.toString().replace(/\n$/g, "")}`, |
| 24 | ); |
| 25 | }); |
| 26 | return cp; |
| 27 | }; |
| 28 | |
| 29 | export const stopWorkspaceProxy = async (cp: ChildProcess) => { |
| 30 | exec(`kill ${cp.pid}`, (error) => { |
no test coverage detected