(command: string, options: { backend?: string } & Record<string, unknown> = {})
| 1018 | } |
| 1019 | |
| 1020 | async exec(command: string, options: { backend?: string } & Record<string, unknown> = {}) { |
| 1021 | const id = this.#resolveId(options.backend) || this.#defaultId; |
| 1022 | // Capture the BackendHandle here, at dispatch time. A late |
| 1023 | // failure from this command's stream must invalidate THIS |
| 1024 | // handle, not whatever the cache holds when the rejection |
| 1025 | // eventually fires; a concurrent reconnect may have already |
| 1026 | // swapped in a newer handle that we must not clobber. |
| 1027 | const { shell, handle: dispatchHandle } = await this.#shellFor(id); |
| 1028 | const { backend: _backend, ...rest } = options; |
| 1029 | let execHandle: unknown; |
| 1030 | try { |
| 1031 | execHandle = await (shell.exec as unknown as (c: string, o: typeof rest) => Promise<unknown>)( |
| 1032 | command, |
| 1033 | rest, |
| 1034 | ); |
| 1035 | } catch (error) { |
| 1036 | this.#onError(id, dispatchHandle, error); |
| 1037 | throw error; |
| 1038 | } |
| 1039 | return this.#wrapHandle(id, dispatchHandle, execHandle); |
| 1040 | } |
| 1041 | |
| 1042 | async get(id: string, options: { backend?: string } & Record<string, unknown> = {}) { |
| 1043 | const backendId = this.#resolveId(options.backend) || this.#defaultId; |
nothing calls this directly
no test coverage detected