geolocation added on offerCar and travel page

This commit is contained in:
arnaucode
2017-01-27 17:49:04 +01:00
parent d76ea5ca19
commit 2b36c80084
727 changed files with 299906 additions and 18 deletions

View 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;
}