Skip to content
Myr

call callback once on listen error

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Wes · committed by Wes Todd · parent 26801a0 · Browse files · 3 files+25 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+25 added−4 removed

  • tests:+14 added−0 removed
  • other:+11 added−4 removed

3 files+25 added−4 removed

modified:lib/application.js+10 added-4 removed
22 unmodified lines
23var compileTrust = require('./utils').compileTrust;24var flatten = require('array-flatten').flatten25var merge = require('utils-merge');26var resolve = require('path').resolve;27var once = require('once')28var Router = require('router');29var setPrototypeOf = require('setprototypeof')3031/**
573 unmodified lines
605 * @return {http.Server}606 * @public607 */608608app.listen = function listen() {609 var server = http.createServer(this);610 return server.listen.apply(server, arguments);611};609app.listen = function listen () {610 var server = http.createServer(this)611 var args = Array.prototype.slice.call(arguments)612 if (typeof args[args.length - 1] === 'function') {613 var done = args[args.length - 1] = once(args[args.length - 1])614 server.once('error', done)615 }616 return server.listen.apply(server, args)617}618619/**620 * Log error using console.error.621 *
21 unmodified lines
modified:test/app.listen.js+14 added
modified:package.json+1 added