forked from enviPath/enviPy
Current Dev State
This commit is contained in:
24
static/js/ketcher2/node_modules/budo/lib/get-ports.js
generated
vendored
Normal file
24
static/js/ketcher2/node_modules/budo/lib/get-ports.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
var xtend = require('xtend')
|
||||
var getPorts = require('get-ports')
|
||||
|
||||
module.exports = getServerPorts
|
||||
function getServerPorts (opt, cb) {
|
||||
opt = xtend({ port: 9966 }, opt)
|
||||
|
||||
// try to use exact port specified or the defaults
|
||||
if (!opt.portfind) {
|
||||
return process.nextTick(function () {
|
||||
cb(null, {
|
||||
port: opt.port
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// find available ports
|
||||
getPorts([ opt.port ], function (err, ports) {
|
||||
if (err) return cb(err)
|
||||
cb(null, {
|
||||
port: ports[0]
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user