whole_func_string: function captureStream(name, callback) {
    var stream = process[name];
    var originalWrite = stream.write;
  
    stream.write = function(str) {
      callback(name, str);
    };
  
    return {
      restore: function() {
        stream.write = originalWrite;
      }
    };
  }
func_code_string: function captureStream(name, callback) {
    var stream = process[name];
    var originalWrite = stream.write;
  
    stream.write = function(str) {
      callback(name, str);
    };
  
    return {
      restore: function() {
        stream.write = originalWrite;
      }
    };
  }
func_documentation_string: Captures a specific stream, and invokes the specified callback with the text written to the stream instead. It returns a function that can be used to restore the captured stream.