Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]:stdout maxBuffer length exceeded

I get this error enter image description here

when running this block of code,

 reasoner = new Reasoner({
    type: 'local', 
    folder: 'csp_files' 
 });

 console.log("solving Model");
 reasoner.solve(Model, (err, stdout, stderr, isSatisfiable) => {
    console.log("isSatisfiable");
    console.log(isSatisfiable);
    if (err) {
        // manage error
        console.log("model error");
        future_response.return("model error");
    } else {
        // manage solution
        console.log(stdout);
        console.log(isSatisfiable);
        future_response.return(stdout);
    }
 });
 console.log("Model solved");
 return future_response.wait();

from what I have read I should find a way to rewrite the stdout to support bigger buffer length, could someone please advice how I could do it? I believe that the library spawn is what I should use, right? I use node version 12.16.1 and meteor

like image 361
user2829319 Avatar asked May 27 '26 23:05

user2829319


1 Answers

You need to use and set the maxBuffer option when using child_process.exec. From the : documentation

It is - the differences between spawn() and exec() of Node's child_process. Use spawn() when you want the child process to return huge binary data to Node, use exec() when you want the child process to return simple status messages.

like image 134
Kunal Ghosh Avatar answered May 30 '26 12:05

Kunal Ghosh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!