Monday, 31 May 2021

RangeError ChildProcess: stderr maxBuffer length exceeded

I am attempting to execute a batch file using the .exec() method.

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

exec('"./Something/Requests/run.bat"', { maxBuffer: 1024 * 500 }, function (error) {
                if (error) {
                    console.log(error);
                }
            })

Error Output:

RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stderr maxBuffer length exceeded
    at Socket.onChildStderr (child_process.js:386:14)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:267:11)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:186:23) {
  code: 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER',
  cmd: '"./Something/Requests/run.bat"'
}

Is there any other way to execute a batch file? I tried file types like .json and it opened the file with notepad just fine.



from RangeError ChildProcess: stderr maxBuffer length exceeded

No comments:

Post a Comment