From: Darren Date: Mon, 24 Mar 2014 08:59:19 +0000 (+0000) Subject: Custom pidfile fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7735c462c0ed8a41027a0b983c900ce3193bf3ad;p=KiwiIRC.git Custom pidfile fix --- diff --git a/server/server.js b/server/server.js index 9f3d49b..4bb95e5 100644 --- a/server/server.js +++ b/server/server.js @@ -1,17 +1,22 @@ var kiwi_app = './kiwi.js'; var pidfile = '../kiwiirc.pid'; +var pidfile_arg; // Check if a pidfile has been set as an argument -var pidfile_arg = process.argv[process.argv.indexOf('-p') + 1]; -if (pidfile_arg) { - // Don't set the relative path if we have an absolute path given to us - if (['/', '\\', '.'].indexOf(pidfile_arg[0]) === -1) { - pidfile = '../' + pidfile_arg; - } else { - pidfile = pidfile_arg; +if (process.argv.indexOf('-p') > -1) { + pidfile_arg = process.argv[process.argv.indexOf('-p') + 1]; + + if (pidfile_arg) { + // Don't set the relative path if we have an absolute path given to us + if (['/', '\\', '.'].indexOf(pidfile_arg[0]) === -1) { + pidfile = '../' + pidfile_arg; + } else { + pidfile = pidfile_arg; + } } } + var daemon = require('daemonize2').setup({ main: kiwi_app, name: 'kiwiirc',