fix listening handler
This commit is contained in:
@ -164,16 +164,17 @@ class LocalWebServer {
|
|||||||
|
|
||||||
const tableLayout = require('table-layout')
|
const tableLayout = require('table-layout')
|
||||||
|
|
||||||
server
|
server.listen(options.port)
|
||||||
.listen(options.port)
|
if (onListening) server.on('listening', onListening)
|
||||||
.on('listening', function () {
|
if (!options.testMode) {
|
||||||
if (options.testMode) return
|
server.on('listening', function () {
|
||||||
const ipList = getIPList()
|
const ipList = getIPList()
|
||||||
.map(iface => `[underline]{${server.isHttps ? 'https' : 'http'}://${iface.address}:${options.port}}`)
|
.map(iface => `[underline]{${server.isHttps ? 'https' : 'http'}://${iface.address}:${options.port}}`)
|
||||||
.join(', ')
|
.join(', ')
|
||||||
console.error(ansi.format('Serving at', 'bold'), ansi.format(ipList))
|
console.error(ansi.format('Serving at', 'bold'), ansi.format(ipList))
|
||||||
})
|
})
|
||||||
.on('listening', onListening)
|
}
|
||||||
|
|
||||||
return server
|
return server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user