( command: string, serverId: string, )
| 905 | } |
| 906 | |
| 907 | async function startInteractiveServer( |
| 908 | command: string, |
| 909 | serverId: string, |
| 910 | ): Promise<string> { |
| 911 | const executor = getExecutor(); |
| 912 | const callback: ExecutorCallback = (type, data) => { |
| 913 | if (type === "stderr") { |
| 914 | if (/proot warning/i.test(data)) return; |
| 915 | addLspLog(serverId, "stderr", data); |
| 916 | console.warn(`[LSP:${serverId}] ${data}`); |
| 917 | } else if (type === "stdout" && data && data.trim()) { |
| 918 | addLspLog(serverId, "info", data); |
| 919 | console.info(`[LSP:${serverId}] ${data}`); |
| 920 | // Detect when the axs proxy signals it's listening |
| 921 | if (/listening on/i.test(data)) { |
| 922 | signalServerReady(serverId); |
| 923 | } |
| 924 | } |
| 925 | }; |
| 926 | const uuid = await executor.start(command, callback, true); |
| 927 | addLspLog(serverId, "info", `Started shell process ${uuid}`); |
| 928 | managedServers.set(serverId, { |
| 929 | uuid, |
| 930 | command, |
| 931 | startedAt: Date.now(), |
| 932 | }); |
| 933 | return uuid; |
| 934 | } |
| 935 | |
| 936 | function sleep(ms: number): Promise<void> { |
| 937 | return new Promise((resolve) => setTimeout(resolve, ms)); |
no test coverage detected