Skip to content

fix: correct stdout buffering issues in spawned processes #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ async function runWebClient(args: Args): Promise<void> {
await spawnPromise("node", [inspectorClientPath, ...startArgs], {
signal: abort.signal,
echoOutput: true,
// pipe the stdout through here, prevents issues with buffering and
// dropping the end of console.out after 8192 chars due to node
// closing the stdout pipe before the output has finished flushing
stdio: "inherit",
});
} catch (e) {
if (!cancelled || process.env.DEBUG) throw e;
Expand Down Expand Up @@ -142,6 +146,10 @@ async function runCli(args: Args): Promise<void> {
env: { ...process.env, ...args.envArgs },
signal: abort.signal,
echoOutput: true,
// pipe the stdout through here, prevents issues with buffering and
// dropping the end of console.out after 8192 chars due to node
// closing the stdout pipe before the output has finished flushing
stdio: "inherit",
});
} catch (e) {
if (!cancelled || process.env.DEBUG) {
Expand Down