lib/capcon.js
function capture(streams, opts, exec) {
  var args = _shift(opts, exec);

  opts = args[0];
  exec = args[1];

  if (!Array.isArray(streams)) {
    streams = [ streams ];
  }

  var outputs = [];

  streams.forEach(function (stream, index) {
    outputs[index] = '';

    startCapture(stream, opts, function (output) {
      outputs[index] += output;
    });
  });

  exec();

  streams.forEach(stopCapture);

  return outputs;
}
function capture(streams, opts, exec) {
  var args = _shift(opts, exec);

  opts = args[0];
  exec = args[1];

  if (!Array.isArray(streams)) {
    streams = [ streams ];
  }

  var outputs = [];

  streams.forEach(function (stream, index) {
    outputs[index] = '';

    startCapture(stream, opts, function (output) {
      outputs[index] += output;
    });
  });

  exec();

  streams.forEach(stopCapture);

  return outputs;
}
/* Public 
Executes the provided function with the output
on the provided streams. Accepts options to silence
the output going to the console.

@param streams a stream or list of streams.
@param opts to set flags on the capture.
@param exec the function to call with the output.
@returns {Array} a list of stream outputs.