Skip to content

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

@piranna

Description

@piranna

(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...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions