Skip to content
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

Use the stdio inherit option when executing the tool #54

Merged
merged 2 commits into from
Oct 20, 2023

Conversation

sgb-io
Copy link
Owner

@sgb-io sgb-io commented Oct 20, 2023

This fixes an issue where parsing very large projects can run into ENOBUFS issues. Using inherit avoids the buffer limit that is introduced by using pipe (the default).

Resolves #48.

There is no test in the project to verify this fix and introducing one seems impractical given the nature of the problem. That said, the fix can be verified using some small node scripts like so:

const { execSync } = require("child_process");

try {
  // Run output.js and capture its stdout
  const output = execSync("node output.js", {
    maxBuffer: 50 * 1024,
    stdio: "inherit", // Switch between pipe and inherit to see the ENOBUFS issue
  }); // Intentionally set a low maxBuffer
  console.log(output.toString());
} catch (error) {
  console.error(`Caught an error: ${error.message}`);
}
// output.js
console.log("A".repeat(2 ** 26)); // Outputs a large 64MB string

@sgb-io sgb-io merged commit 64ca6ac into main Oct 20, 2023
8 checks passed
@sgb-io sgb-io deleted the feat/chunk-standard-output branch October 20, 2023 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fta output fails on extremely long output
1 participant