(
childProcess: ChildProcess,
abortSignal: AbortSignal,
timeout: number,
taskOutput: TaskOutput,
shouldAutoBackground = false,
maxOutputBytes = MAX_TASK_OUTPUT_BYTES,
)
| 146 | ) => void |
| 147 | |
| 148 | constructor( |
| 149 | childProcess: ChildProcess, |
| 150 | abortSignal: AbortSignal, |
| 151 | timeout: number, |
| 152 | taskOutput: TaskOutput, |
| 153 | shouldAutoBackground = false, |
| 154 | maxOutputBytes = MAX_TASK_OUTPUT_BYTES, |
| 155 | ) { |
| 156 | this.#childProcess = childProcess |
| 157 | this.#abortSignal = abortSignal |
| 158 | this.#timeout = timeout |
| 159 | this.#shouldAutoBackground = shouldAutoBackground |
| 160 | this.#maxOutputBytes = maxOutputBytes |
| 161 | this.taskOutput = taskOutput |
| 162 | |
| 163 | // In file mode (bash commands), both stdout and stderr go to the |
| 164 | // output file fd — childProcess.stdout/.stderr are both null. |
| 165 | // In pipe mode (hooks), wrap streams to funnel data into TaskOutput. |
| 166 | this.#stderrWrapper = childProcess.stderr |
| 167 | ? new StreamWrapper(childProcess.stderr, taskOutput, true) |
| 168 | : null |
| 169 | this.#stdoutWrapper = childProcess.stdout |
| 170 | ? new StreamWrapper(childProcess.stdout, taskOutput, false) |
| 171 | : null |
| 172 | |
| 173 | if (shouldAutoBackground) { |
| 174 | this.onTimeout = (callback): void => { |
| 175 | this.#onTimeoutCallback = callback |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | this.result = this.#createResultPromise() |
| 180 | } |
| 181 | |
| 182 | get status(): 'running' | 'backgrounded' | 'completed' | 'killed' { |
| 183 | return this.#status |
nothing calls this directly
no test coverage detected