|
1 |
| -import { ChildProcess, spawn } from "node:child_process"; |
| 1 | +import { ChildProcess, IOType, spawn } from "node:child_process"; |
2 | 2 | import process from "node:process";
|
3 | 3 | import { ReadBuffer, serializeMessage } from "../shared/stdio.js";
|
4 | 4 | import { JSONRPCMessage } from "../types.js";
|
@@ -28,7 +28,7 @@ export type StdioServerParameters = {
|
28 | 28 | *
|
29 | 29 | * The default is "inherit", meaning messages to stderr will be printed to the parent process's stderr.
|
30 | 30 | */
|
31 |
| - stderr?: "inherit" | "ignore" | Stream; |
| 31 | + stderr?: IOType | Stream | number; |
32 | 32 | };
|
33 | 33 |
|
34 | 34 | /**
|
@@ -123,7 +123,7 @@ export class StdioClientTransport implements Transport {
|
123 | 123 | // (i.e. via `electron-forge start`) vs a production environment
|
124 | 124 | // (i.e. YourApp.exe).
|
125 | 125 | detached: process.platform === "win32" && isElectron(),
|
126 |
| - } |
| 126 | + }, |
127 | 127 | );
|
128 | 128 |
|
129 | 129 | this._process.on("error", (error) => {
|
@@ -161,6 +161,15 @@ export class StdioClientTransport implements Transport {
|
161 | 161 | });
|
162 | 162 | }
|
163 | 163 |
|
| 164 | + /** |
| 165 | + * The stderr stream of the child process, if `StdioServerParameters.stderr` was set to "pipe" or "overlapped". |
| 166 | + * |
| 167 | + * This is only available after the process has been started. |
| 168 | + */ |
| 169 | + get stderr(): Stream | null { |
| 170 | + return this._process?.stderr ?? null; |
| 171 | + } |
| 172 | + |
164 | 173 | private processReadBuffer() {
|
165 | 174 | while (true) {
|
166 | 175 | try {
|
|
0 commit comments