Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@jwdeitch
Copy link

Allow unlimited buffer for child_process'

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

child_process

@nodejs-github-bot nodejs-github-bot added the child_process Issues and PRs related to the child_process subsystem. label Jan 12, 2017
@mscdex
Copy link
Contributor

mscdex commented Jan 12, 2017

This isn't necessary, just pass Infinity as your maxBuffer value.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 12, 2017

Yes, what @mscdex said. Also, this patch doesn't address stderr.

@addaleax
Copy link
Member

Fwiw, passing Infinity seems to give an TypeError: "maxBuffer" must be an unsigned integer error?

@cjihrig
Copy link
Contributor

cjihrig commented Jan 12, 2017

That should only happen for spawnSync(). execFile() should handle it fine.

@addaleax
Copy link
Member

execFile() should handle it fine.

I tested this as:

> child_process.execSync('cat /dev/urandom', {maxBuffer:Infinity})
TypeError: "maxBuffer" must be an unsigned integer

@cjihrig
Copy link
Contributor

cjihrig commented Jan 12, 2017

Yea, execSync() uses spawnSync() under the hood. execFile() should work though. I'm looking into making spawnSync() support Infinity right now.

@sam-github
Copy link
Contributor

sam-github commented Jan 12, 2017

I think allowing Infinity would be better than 0 to mean unlimited.

That Infinity is valid isn't documented anywhere, and apparently, its support is random: yes for execFile, no for spawnSync, and for execFileSync, who knows? Is that accidental, or intentional?

And

> child_process.execSync('date', {maxBuffer: Infinity}, ()=>{})
node: ../deps/uv/src/unix/core.c:166: uv_close: Assertion `0' failed.
zsh: abort (core dumped)  node
core/node (master $% u=) % node --version 
v7.2.0

Hm. EDIT: #10768

execFileSync also doesn't document a default for maxBuffer, its not clear if its defaulting to no limit, or to something else.

@mscdex
Copy link
Contributor

mscdex commented Jan 12, 2017

I don't know why the sync counterparts perform different argument checking. I'd personally prefer simpler validation, that the value is just a number (typeof maxBuffer === 'number') rather than strictly Number.isInteger(maxBuffer).

@sam-github
Copy link
Contributor

Btw, rebuilding to see if the abort is reproduceable.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 12, 2017

The sync calls don't currently support it because it is CHECK()'ed as a uint in C++.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 12, 2017

#10769

@jwdeitch jwdeitch closed this Jan 12, 2017
cjihrig added a commit to cjihrig/node that referenced this pull request Jan 17, 2017
Fixes: nodejs#10767
PR-URL: nodejs#10769
Reviewed-By: James M Snell <jasnell@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
Fixes: nodejs#10767
PR-URL: nodejs#10769
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

child_process Issues and PRs related to the child_process subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.