mirror of
https://github.com/arnaucube/commonroutesApp.git
synced 2026-02-08 03:56:41 +01:00
geolocation added on offerCar and travel page
This commit is contained in:
23
www/lib/ui-leaflet/grunt/utils/getAvailPort.js
Normal file
23
www/lib/ui-leaflet/grunt/utils/getAvailPort.js
Normal file
@@ -0,0 +1,23 @@
|
||||
var exec = require('shelljs').exec;
|
||||
|
||||
var isWin = /^win/.test(process.platform);
|
||||
|
||||
var isPortOpen = function (port) {
|
||||
var cmd;
|
||||
if (isWin)
|
||||
cmd = 'netstat -an | find /i ":' + port + '" | find /i "listening"';
|
||||
else
|
||||
cmd = 'lsof -i:' + port + " | tail -n 1 | awk '{print $2}'";
|
||||
var portResponse = exec(cmd, {
|
||||
silent: true
|
||||
}).output;
|
||||
return portResponse ? false : true;
|
||||
}
|
||||
|
||||
module.exports = function (startPort) {
|
||||
while (!isPortOpen(startPort)) {
|
||||
startPort += 1;
|
||||
}
|
||||
|
||||
return startPort;
|
||||
}
|
||||
Reference in New Issue
Block a user