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

Option to don't use an output buffer on child_process sync methods #481

Closed
piranna opened this issue Jan 17, 2015 · 3 comments
Closed

Option to don't use an output buffer on child_process sync methods #481

piranna opened this issue Jan 17, 2015 · 3 comments

Comments

@piranna
Copy link
Contributor

piranna commented Jan 17, 2015

(This is a duplicate issue also reported on Node.js repository)

The child_process.exec documentation says:

maxBuffer specifies the largest amount of data allowed on stdout or stderr - if this value is exceeded then the child process is killed

and I assume this also apply to child_process.execFile, child_process.spawnSync, child_process.execFileSync and child_process.execSync, since all of them has the maxBuffer option.

To create scripts that exec commands that give a HUGE output (like make) this can be a problem, specially since you don't know how big they can be and at the same time, you are not worried to store their output (showing it on the console it's usually enough) and also they would waste a lot of memory in useless data, so I propose to add an option to don't buffer the output at all. A good way to enable this is to set maxBuffer to a negative number (a special case of maxNumber = 0 would be still a valid value when you don't expect the command to give an output at all, and if so it's due to an error...).

@cjihrig
Copy link
Contributor

cjihrig commented Jan 17, 2015

Have you tried setting the child's stdout and stderr to ignore, or setting maxBuffer to Infinity?

@piranna
Copy link
Contributor Author

piranna commented Jan 17, 2015

I've answered on the Node.js issue, maybe it's better to focus the discussion in only one place (and this one affect to both projects).

@piscisaureus
Copy link
Contributor

Discussion here: nodejs/node-v0.x-archive#9057

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

No branches or pull requests

3 participants