diff --git a/cli/cmd.js b/cli/cmd.js index 5e96f8c7e..fe234f725 100644 --- a/cli/cmd.js +++ b/cli/cmd.js @@ -292,28 +292,28 @@ const setup = function setup() { }; var child = new(forever.Monitor)(path.join(__dirname, '..', 'app.js'), foreverOptions); if (options.action == "start") { - try { - fs.appendFileSync(pidpath, process.pid+'|'); - child.start(); - } catch (piderr) { - console.error('failed to start microgateway: ' + piderr); - process.exit(1); - } + try { + fs.appendFileSync(pidpath, process.pid + '|'); + child.start(); + } catch (piderr) { + console.error('failed to start microgateway: ' + piderr); + process.exit(1); + } } else { - try { - var pids = fs.readFileSync(pidpath,'utf8').split('|'); - if (pids) { - pids.forEach(function(pid){ - process.kill(parseInt(pid), 'SIGINT'); - }); - fs.unlinkSync(pidpath); - } else { - console.log('pid file not found. please run this command from the folder where microgateway was started.') - } - } catch (piderr) { - console.error('failed to stop microgateway: ' + piderr); - process.exit(1); - } + try { + var pids = fs.readFileSync(pidpath, 'utf8').split('|'); + if (pids) { + pids.forEach(function(pid) { + process.kill(parseInt(pid), 'SIGINT'); + }); + fs.unlinkSync(pidpath); + } else { + console.log('pid file not found. please run this command from the folder where microgateway was started.') + } + } catch (piderr) { + console.error('failed to stop microgateway: ' + piderr); + process.exit(1); + } } }); diff --git a/cli/lib/gateway.js b/cli/lib/gateway.js index 0b0f77f64..c818ca4d8 100644 --- a/cli/lib/gateway.js +++ b/cli/lib/gateway.js @@ -125,8 +125,8 @@ Gateway.prototype.start = (options) => { if (!isWin) { console.log('Removing the socket file as part of cleanup'); fs.unlinkSync(ipcPath); - fs.unlinkSync(pidPath) } + fs.unlinkSync(pidPath); }); process.on('SIGTERM', () => { diff --git a/config/locations.js b/config/locations.js index 00a34658a..38928dbdf 100644 --- a/config/locations.js +++ b/config/locations.js @@ -48,12 +48,7 @@ module.exports = { } }, getPIDFilePath: function getPIDFilePath() { - if (!isWin) { - return path.join(process.cwd(), defaultIPCFileName + '.pid'); - } else { - return path.join('\\\\?\\pipe', process.cwd(), defaultIPCFileName+'.pid'); - } - + return path.join(process.cwd(), defaultIPCFileName + '.pid'); }, homeDir: homeDir, defaultDir: configDir, diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 4cca4ed79..bc336b015 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,5 +1,5 @@ { "name": "edgemicro", - "version": "2.5.15", + "version": "2.5.16", "lockfileVersion": 1 } diff --git a/package.json b/package.json index 4b7868298..a02914e74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "edgemicro", - "version": "2.5.15", + "version": "2.5.16", "description": "Apigee Edge Microgateway", "main": "index.js", "license": "Apache-2.0",