Note:  src.unpipe is called by stream.Readable internals on dest 'error'
494097
function onOutError(err) {
    errNodecat = combineErrors(errNodecat, err);
    errStream.write(`nodecat: ${err}\n`);
    if (inCleanup) {
      inCleanup();
    }
    allDone();
  }
759416
public void unjar(InputStream in, File destDir) throws IOException {
		BufferedOutputStream dest = null;
		JarInputStream jis = new JarInputStream(in);
		JarEntry entry;
		while ((entry = jis.getNextJarEntry()) != null) {
			if (entry.isDirectory()) {
				File dir = new File(destDir, entry.getName());
				dir.mkdir();
				if (entry.getTime() != -1) {
					dir.setLastModified(entry.getTime());
				}
				continue;
			}
			int count;
			byte[] data = new byte[BUFFER_SIZE];
			File destFile = new File(destDir, entry.getName());
			if (mVerbose) {
				System.out.println("unjarring " + destFile +
					" from " + entry.getName());
			}
			FileOutputStream fos = new FileOutputStream(destFile);
			dest = new BufferedOutputStream(fos, BUFFER_SIZE);
			try {
				while ((count = jis.read(data, 0, BUFFER_SIZE)) != -1) {
					dest.write(data, 0, count);
				}
				dest.flush();
			} finally {
				dest.close();
			}
			if (entry.getTime() != -1) {
				destFile.setLastModified(entry.getTime());
			}
		}
		jis.close();
	}
469220
function lint (files) {
  const stream = gulp.src(files)
  .pipe($.plumber())
  .pipe($.eslint())
  .pipe($.eslint.format())
  if (process.env.NODE_ENV === 'production') {
    stream.pipe($.eslint.failOnError())
  }
  stream.on('error', onError)
  return stream
}
1013400
function onerror(er) {
    debug('onerror', er);
    unpipe();
    dest.removeListener('error', onerror);
    if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  }
1209274
function procES6(src, base, dest = '', handle_error = false, min = false) {
    const babelOptions = requireJSON.parse(fs.readFileSync('./.babelrc', 'utf8'));
    let bo = Object.assign(babelOptions);
    let bplg = bo.plugins || (bo.plugins = []);
    bplg.push("external-helpers");
    bo.exclude = "node_modules/**";

    let plugins = [
        // require('rollup-plugin-strip')(),
        require('rollup-plugin-babel')(bo),
    ];

    if ( min ) {
        plugins.push(require('rollup-plugin-uglify')({
            output: {
                comments: function(node, comment) {
                    let { value, type } = comment;
                    // multiline comment
                    if (type === "comment2") {
                        return /@preserve|@license|@cc_on/i.test(value);
                    }
                },
            },
        }));
    }

    let s = gulp.src(src, { base })
        .pipe($.sourcemaps.init({loadMaps:true}))
        // .pipe($.babel(babelOptions))

        .pipe($.betterRollup({ plugins }, 'umd'))
        // .pipe($.rename((fn)=>{fn.basename = path.basename(fn.basename, '.es')}))
    ;
    if ( handle_error ) {
        handle_stream_error(s);
    }
    if ( min ) {
        s = s.pipe($.rename({extname: '.min.js'}));
    }
    s = s.pipe($.sourcemaps.write('.'));
    if ( dest ) {
        s = s.pipe(gulp.dest(dest));
    }
    return s;
}
969660
void dus(String src) throws IOException {
    Path srcPath = new Path(src);
    FileSystem srcFs = srcPath.getFileSystem(getConf());
    FileStatus status[] = srcFs.globStatus(new Path(src));
    if (status==null || status.length==0) {
      throw new FileNotFoundException("Cannot access " + src + 
          ": No such file or directory.");
    }
    for(int i=0; i<status.length; i++) {
      long totalSize = srcFs.getContentSummary(status[i].getPath()).getLength();
      String pathStr = status[i].getPath().toString();
      System.out.println(("".equals(pathStr)?".":pathStr) + "\t" + totalSize);
    }
  }
504882
function dumpAndWrap(fName /*, localDir:string*/, sourceToDump) {
    let p = new Promise(function (resolve) {
        fs.stat(fName, (err, stat) => {
            if (!err) {
                if (stat.isFile()) {
                    logger.debug(`Found a file to wrap at ${fName}`);
                    let stream = fs.createReadStream(fName, {
                        'encoding': 'utf8'
                    });
                    resolve(stream);
                    return;
                }
                logger.error(`Should not be here:\n ${util.format(stat)}`);
            }
            else {
                logger.warn(`cant find file ${fName}`);
                if (sourceToDump) {
                    logger.debug(`Found alternative source dumping it from \n ${util.format(sourceToDump)}`);
                    let target = fs.createWriteStream(fName, { 'flags': 'a' });
                    sourceToDump.pipe(target);
                    target.on('close', () => {
                        let stream = fs.createReadStream(fName, {
                            'encoding': 'utf8'
                        });
                        logger.debug(`should resolve with ${util.format(stream)}`);
                        resolve(stream);
                        return;
                    });
                }
                else {
                    logger.error("Output file error, Still cant open output file, returning empy stream");
                    let dummyStream = new streamLib.Readable();
                    dummyStream.push(null);
                    resolve(dummyStream);
                    return;
                }
            }
        });
    });
    return p;
}
1307627
function (o, cb) {
    if (!o.out) {
      throw new Error('output dir missing');
    }

    this.src(o)
      .on('error', handleCallbackError(cb))
      .pipe(vfs.dest(function (file) {
        return file.base;
      }))
      .on('error', handleCallbackError(cb))
      .on('end', function () {
        if (_.isFunction(cb) && !error) {
          cb();
        }
      });
  }
606525
function fsOperationFailed(stream, sourceFile, err) {
	if (err.code !== 'ENOENT') {
		stream.emit('error', new PluginError('gulp-changed', err, {
			fileName: sourceFile.path
		}));
	}

	stream.push(sourceFile);
}
57310
function jsonCloseError(options) {
    if (options === void 0) { options = {}; }
    options.debugLocalNetwork = options.debugLocalNetwork == null ? true : options.debugLocalNetwork;
    return function (err, req, res, next) {
        try {
            err = toError(err);
            var statusMessage = err.message || err.code;
            var statusCode = err.status || err.statusCode || 500;
            statusMessage = cleanStatusMessage(statusMessage);
            statusCode = statusCode.toString().replace(/[^0-9]/g, '');
            res.statusMessage = statusMessage;
            res.statusCode = statusCode;
            var rtn = {
                error: {
                    message: statusMessage,
                    code: statusCode,
                    "debug": {
                        "stack": err.stack
                    }
                }
            };
            var isDebug = err.stack && (options.debug || (options.debugLocalNetwork && ack.reqres(req, res).req.isLocalNetwork()));
            if (isDebug) {
                rtn.error["stack"] = err.stack; //debug requests will get stack traces
            }
            /*
                  if(res.json){
                    res.json(rtn)
                  }else{
                    var output = JSON.stringify(rtn)
                    res.setHeader('message', statusMessage)
                    res.setHeader('Content-Type','application/json')
                    res.setHeader('Content-Length', output.length.toString())
                    res.end( output );
                  }
            */
            var output = JSON.stringify(rtn);
            res.setHeader('message', statusMessage);
            res.setHeader('Content-Type', 'application/json');
            res.setHeader('Content-Length', output.length.toString());
            res.end(output);
        }
        catch (e) {
            console.error('ack/modules/reqres/res.js jsonCloseError failed hard');
            console.error(e);
            console.error('------ original error ------', statusMessage);
            console.error(err);
            if (next) {
                next(err);
            }
            else {
                throw err;
            }
        }
    };
}
1206618
void du(String src) throws IOException {
    Path srcPath = new Path(src);
    FileSystem srcFs = srcPath.getFileSystem(getConf());
    Path[] pathItems = FileUtil.stat2Paths(srcFs.globStatus(srcPath), 
                                           srcPath);
    FileStatus items[] = srcFs.listStatus(pathItems);
    if ((items == null) || ((items.length == 0) && 
        (!srcFs.exists(srcPath)))){
      throw new FileNotFoundException("Cannot access " + src
            + ": No such file or directory.");
    } else {
      System.out.println("Found " + items.length + " items");
      int maxLength = 10;
      
      long length[] = new long[items.length];
      for (int i = 0; i < items.length; i++) {
        length[i] = items[i].isDir() ?
          srcFs.getContentSummary(items[i].getPath()).getLength() :
          items[i].getLen();
        int len = String.valueOf(length[i]).length();
        if (len > maxLength) maxLength = len;
      }
      for(int i = 0; i < items.length; i++) {
        System.out.printf("%-"+ (maxLength + BORDER) +"d", length[i]);
        System.out.println(items[i].getPath());
      }
    }
  }
129044
function(opts = {}) {
  if (opts.handleUncaughtExceptions == null) {
    opts.handleUncaughtExceptions = true;
  }
  if (opts.structuredStackTrace == null) {
    opts.structuredStackTrace = false;
  }
  if (opts.handleUncaughtExceptions) {
    process.on('uncaughtException', function(err) {
      prettyPrint(err, {
        colorize: process.stdout.isTTY
      });
      return process.exit(1);
    });
  }
  return Error.prepareStackTrace = function(err, stack) {
    var _stack, frame;
    _stack = (function() {
      var i, len, results;
      results = [];
      for (i = 0, len = stack.length; i < len; i++) {
        frame = stack[i];
        results.push(wrap(err, frame));
      }
      return results;
    })();
    if (opts.structuredStackTrace) {
      err.structuredStackTrace = structured(err, stack);
    }
    return err + ((function() {
      var i, len, results;
      results = [];
      for (i = 0, len = _stack.length; i < len; i++) {
        frame = _stack[i];
        results.push('\n    at ' + frame);
      }
      return results;
    })()).join('');
  };
}
1347286
function (stream, destPath) {
    let data = '';
    return new Promise(function (resolve, reject) {
        stream.on('error', reject);
        stream.on('data', function (d) {
            data += d.toString();
        });
        stream.on('end', function () {
            fs.outputFile(destPath, data, function (err) {
                if (!err) {
                    resolve();
                } else {
                    reject(err);
                }
            });
        });
    });
}
509107
def unload_module(self, path):
        '''

        '''
        with self._mutex:
            if self._obj.unload_module(path) != RTC.RTC_OK:
                raise FailedToUnloadModuleError(path)
558771
function( err, streams ) {

			// Get base name
			var path = originalFile.path;
			var parts = path.split("."); parts.pop();
			var baseName =  parts.join(".");

	    	// Push each stream to output
	    	for (var i=0; i<streams.length; i++) {
	    		var f = originalFile.clone();
	    		f.contents = streams[i][0]; // Content
	    		f.path = baseName + streams[i][1]; // Suffix
				self.push(f);
	    	}

	    	// We are done
			done();
			return;
	    }
683914
def internal_error (out=stderr, etype=None, evalue=None, tb=None):
    """"""
    print(os.linesep, file=out)
    print(_("""********** Oops, I did it again. *************

You have found an internal error in LinkChecker. Please write a bug report
at %s
and include the following information:
- the URL or file you are testing
- the system information below

When using the commandline client:
- your commandline arguments and any custom configuration files.
- the output of a debug run with option "-Dall"

Not disclosing some of the information above due to privacy reasons is ok.
I will try to help you nonetheless, but you have to give me something
I can work with ;) .
""") % configuration.SupportUrl, file=out)
    if etype is None:
        etype = sys.exc_info()[0]
    if evalue is None:
        evalue = sys.exc_info()[1]
    if tb is None:
        tb = sys.exc_info()[2]
    better_exchook2.better_exchook(etype, evalue, tb, out=out)
    print_app_info(out=out)
    print_proxy_info(out=out)
    print_locale_info(out=out)
    print(os.linesep,
      _("******** LinkChecker internal error, over and out ********"), file=out)
865884
function FileReadStream(path, options) {
  stream.Stream.call(this);
  this.readable = true;

  if(!options) {
    options = {};
  }

  this._destroyed = false;
  this._streamEnded = false;
  this._fd = null;
  this._fileName = undefined;
  this._highWaterMark = options.highWaterMark || bufferSize;
  this._offset = 0;
  this._paused = undefined;
  this._allocator = options.allocator;
  this._fileName = path;

  this._md5hash = null;
  this._md5sum = undefined;

  if (options.calcContentMd5) {
    this._md5hash = new Md5Wrapper().createMd5Hash();
  }

  this._open();
}