From 24e899bdca26215409024b53d10596f55bcbda02 Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Tue, 17 Dec 2013 11:10:42 -0800 Subject: [PATCH] make sure show-config works with npm (fix #1630) --- lib/server/main.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/server/main.js b/lib/server/main.js index 0fc07a38f69..6110a396adc 100644 --- a/lib/server/main.js +++ b/lib/server/main.js @@ -31,18 +31,19 @@ var http = require('http') , conditionallyPreLaunch = helpers.conditionallyPreLaunch , noColorLogger = helpers.noColorLogger; -if (require.main === module && args.showConfig) { - try { - var config = fs.readFileSync(configFile); - console.log(config.toString('utf8')); - process.exit(0); - } catch (e) { - console.error("Error: Appium is not correctly configured"); - process.exit(1); +var main = function(args, readyCb, doneCb) { + + if (args.showConfig) { + try { + var config = fs.readFileSync(configFile); + console.log(config.toString('utf8')); + process.exit(0); + } catch (e) { + console.error("Error: Appium is not correctly configured"); + process.exit(1); + } } -} -var main = function(args, readyCb, doneCb) { checkArgs(args); if (typeof doneCb === "undefined") { doneCb = function() {};