var kiwi_app = './kiwi.js';\r
var pidfile = '../kiwiirc.pid';\r
+var pidfile_arg;\r
\r
// Check if a pidfile has been set as an argument\r
-var pidfile_arg = process.argv[process.argv.indexOf('-p') + 1];\r
-if (pidfile_arg) {\r
- // Don't set the relative path if we have an absolute path given to us\r
- if (['/', '\\', '.'].indexOf(pidfile_arg[0]) === -1) {\r
- pidfile = '../' + pidfile_arg;\r
- } else {\r
- pidfile = pidfile_arg;\r
+if (process.argv.indexOf('-p') > -1) {\r
+ pidfile_arg = process.argv[process.argv.indexOf('-p') + 1];\r
+\r
+ if (pidfile_arg) {\r
+ // Don't set the relative path if we have an absolute path given to us\r
+ if (['/', '\\', '.'].indexOf(pidfile_arg[0]) === -1) {\r
+ pidfile = '../' + pidfile_arg;\r
+ } else {\r
+ pidfile = pidfile_arg;\r
+ }\r
}\r
}\r
\r
+\r
var daemon = require('daemonize2').setup({\r
main: kiwi_app,\r
name: 'kiwiirc',\r