(
source: string,
options: WorkspaceRuntimeExecOptions<E> = {},
)
| 37 | options: WorkspaceRuntimeExecOptions<undefined>, |
| 38 | ): Promise<WorkspaceRuntimeExecHandle<undefined>>; |
| 39 | async exec<E extends ExecEncoding>( |
| 40 | source: string, |
| 41 | options: WorkspaceRuntimeExecOptions<E> = {}, |
| 42 | ): Promise<WorkspaceRuntimeExecHandle<E>> { |
| 43 | if (options.id !== undefined) assertExecutionId(options.id); |
| 44 | const backend = this.#backend(options.backend); |
| 45 | if (options.input !== undefined && !this.#options.callableBackendIds.has(backend)) { |
| 46 | throw new Error( |
| 47 | `Backend ${JSON.stringify(backend)} is not callable; it does not accept structured input.`, |
| 48 | ); |
| 49 | } |
| 50 | if (this.#options.commandBackendIds.has(backend)) { |
| 51 | if (options.input !== undefined) { |
| 52 | throw new Error( |
| 53 | `Backend ${JSON.stringify(backend)} is not callable; it does not accept structured input.`, |
| 54 | ); |
| 55 | } |
| 56 | const shell = this.#options.shell(); |
| 57 | const handle = await ( |
| 58 | shell.exec as unknown as ( |
| 59 | command: string, |
| 60 | options: Record<string, unknown>, |
| 61 | ) => Promise<ExecHandle<E>> |
| 62 | )(source, { |
| 63 | backend, |
| 64 | cwd: options.cwd, |
| 65 | encoding: options.encoding, |
| 66 | id: options.id, |
| 67 | timeoutMs: options.timeoutMs, |
| 68 | env: options.env, |
| 69 | stdin: options.stdin, |
| 70 | }); |
| 71 | return wrapCommandHandle(handle, backend); |
| 72 | } |
| 73 | |
| 74 | const runtime = await this.#options.moduleHandle(backend); |
| 75 | const envelope = await runtime.exec({ |
| 76 | id: options.id, |
| 77 | source, |
| 78 | cwd: options.cwd, |
| 79 | input: options.input, |
| 80 | env: options.env, |
| 81 | stdin: options.stdin, |
| 82 | timeoutMs: options.timeoutMs, |
| 83 | }); |
| 84 | return wrapModuleHandle(runtime, backend, envelope.id, envelope.events, options.encoding); |
| 85 | } |
| 86 | |
| 87 | getExec(id: string): Promise<WorkspaceRuntimeExecHandle<undefined>>; |
| 88 | getExec( |
nothing calls this directly
no test coverage detected