Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Commit

Permalink
Add --unlimited-buffer shell output option. (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-roemer committed Apr 8, 2016
1 parent a22ce67 commit fa8e8b5
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
History
=======

## Current

* Add `--unlimited-buffer` shell output option.

## 2.9.1

* Refactor lodash calls to be tolerant of v3 or v4 as a temporary bandaid to
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Flags:
* `--setup`: Single task to run for the entirety of `<action>`
* `--quiet`: Silence logging
* `--log-level`: Level to log at (`info`, `warn`, `error`, `none`)
* `--unlimited-buffer`: Unlimited shell output buffer.
* `--expand-archetype`: Expand `node_modules/<archetype>` with full path (default: `false`)
* `--builderrc`: Path to builder config file (default: `.builderrc`)

Expand All @@ -246,6 +247,7 @@ Flags:
* `--[no-]bail`: End all processes after the first failure (default: `true`)
* `--quiet`: Silence logging
* `--log-level`: Level to log at (`info`, `warn`, `error`, `none`)
* `--unlimited-buffer`: Unlimited shell output buffer.
* `--expand-archetype`: Expand `node_modules/<archetype>` with full path (default: `false`)
* `--builderrc`: Path to builder config file (default: `.builderrc`)

Expand Down Expand Up @@ -288,6 +290,7 @@ Flags:
* `--envs-path`: Path to JSON env variable array file (default: `null`)
* `--quiet`: Silence logging
* `--log-level`: Level to log at (`info`, `warn`, `error`, `none`)
* `--unlimited-buffer`: Unlimited shell output buffer.
* `--expand-archetype`: Expand `node_modules/<archetype>` with full path (default: `false`)
* `--builderrc`: Path to builder config file (default: `.builderrc`)

Expand Down
5 changes: 5 additions & 0 deletions lib/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ var FLAGS = {
desc: "Level to log at (`info`, `warn`, `error`, `none`)",
types: [String],
default: "info"
},
"unlimited-buffer": {
desc: "Use an unlimited buffer for shell commands",
types: [Boolean],
default: false
}
},

Expand Down
4 changes: 3 additions & 1 deletion lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ var expandArchetype = function (cmd, opts, env) {
* @returns {Object} Child process object
*/
var run = function (cmd, shOpts, opts, callback) {
var maxBuffer = opts.unlimitedBuffer ? Infinity : MAX_BUFFER;

// Update shell options and ensure basic structure.
shOpts = _.extend({
maxBuffer: MAX_BUFFER,
maxBuffer: maxBuffer,
env: {}
}, shOpts);

Expand Down
22 changes: 22 additions & 0 deletions test/server/spec/bin/builder-core.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,28 @@ describe("bin/builder-core", function () {

}));

it("runs a with an unlimited buffer", stdioWrap(function (done) {
base.sandbox.spy(Task.prototype, "run");
base.mockFs({
"package.json": JSON.stringify({
"scripts": {
"bar": "echo BAR_TASK"
}
}, null, 2)
});

run({
argv: ["node", "builder", "run", "--unlimited-buffer", "bar"]
}, function (err) {
if (err) { return done(err); }

expect(Task.prototype.run).to.be.calledOnce;
expect(process.stdout.write).to.be.calledWithMatch("BAR_TASK");

done();
});

}));
it("runs with quiet log output", stdioWrap(function (done) {
base.sandbox.spy(Task.prototype, "run");
base.mockFs({
Expand Down
2 changes: 2 additions & 0 deletions test/server/spec/lib/args.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe("lib/args", function () {
builderrc: ".builderrc",
help: false,
logLevel: "info",
unlimitedBuffer: false,
quiet: false,
version: false
});
Expand All @@ -39,6 +40,7 @@ describe("lib/args", function () {
builderrc: dummyPath,
help: false,
logLevel: "info",
unlimitedBuffer: false,
quiet: false,
version: false
});
Expand Down

0 comments on commit fa8e8b5

Please sign in to comment.