Skip to content

Commit

Permalink
increase default max buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 25, 2016
1 parent 1159f25 commit 3619e4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Specify some options to be passed to the [.exec()](https://nodejs.org/api/child_
- `setsid` boolean
- `encoding` string *(Default: `'utf8'`)*
- `timeout` number *(Default: `0`)*
- `maxBuffer` number *(Default: `200 * 1024`)*
- `maxBuffer` number *(Default: `1000 * 1000 * 10` → 10 MB)*
- `killSignal` string *(Default: `'SIGTERM'`)*


Expand Down
6 changes: 6 additions & 0 deletions tasks/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const exec = require('child_process').exec;
const chalk = require('chalk');
const npmRunPath = require('npm-run-path');

const TEN_MEGABYTES = 1000 * 1000 * 10;

module.exports = grunt => {
grunt.registerMultiTask('shell', 'Run shell commands', function () {
const cb = this.async();
Expand All @@ -24,6 +26,10 @@ module.exports = grunt => {
throw new Error('`command` required');
}

// increase max buffer
opts.execOptions = Object.assign({}, opts.execOptions);
opts.execOptions.maxBuffer = opts.execOptions.maxBuffer || TEN_MEGABYTES;

cmd = grunt.template.process(typeof cmd === 'function' ? cmd.apply(grunt, arguments) : cmd);

if (opts.preferLocal === true) {
Expand Down

0 comments on commit 3619e4c

Please sign in to comment.