MCPcopy Index your code
hub / github.com/github/copilot-sdk / start

Method start

nodejs/test/e2e/harness/CapiProxy.ts:35–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33 }
34
35 async start(): Promise<string> {
36 const serverProcess = spawn("npx", ["tsx", HARNESS_SERVER_PATH], {
37 stdio: ["ignore", "pipe", "inherit"],
38 shell: true,
39 });
40
41 this.startupInfo = await new Promise<ProxyStartupInfo>((resolve, reject) => {
42 const stdout = serverProcess.stdout!;
43 const lines: string[] = [];
44 const lineReader = createInterface({ input: stdout });
45 const cleanup = () => {
46 lineReader.off("line", onLine);
47 serverProcess.off("exit", onExit);
48 lineReader.close();
49 };
50 const onLine = (line: string) => {
51 lines.push(line);
52 try {
53 const info = tryParseStartupInfo(line);
54 if (!info) {
55 return;
56 }
57 cleanup();
58 resolve(info);
59 } catch (error) {
60 cleanup();
61 reject(error);
62 }
63 };
64 const onExit = (code: number | null) => {
65 cleanup();
66 reject(
67 new Error(`Proxy exited before startup with code ${code}: ${lines.join("\n")}`)
68 );
69 };
70 lineReader.on("line", onLine);
71 serverProcess.once("exit", onExit);
72 });
73 this.proxyUrl = this.startupInfo.capiProxyUrl;
74
75 return this.proxyUrl;
76 }
77
78 getProxyEnv(): Record<string, string> {
79 if (!this.startupInfo?.connectProxyUrl || !this.startupInfo.caFilePath) {

Calls 1

onMethod · 0.45

Tested by 2