You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/12/04 21:54:25 UTC

[cordova-paramedic] branch master updated: Fix exec usage (#83)

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git


The following commit(s) were added to refs/heads/master by this push:
     new 9146804  Fix exec usage (#83)
9146804 is described below

commit 91468049bb1d1def39beb5370ad62dba25f382da
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Tue Dec 4 22:54:21 2018 +0100

    Fix exec usage (#83)
    
    * fix exec usage
    
    * improve log message
    
    * fix and improve command output
---
 lib/ParamedicAppUninstall.js  |  2 +-
 lib/ParamedicKill.js          |  4 ++--
 lib/ParamedicLog.js           |  2 +-
 lib/ParamedicTargetChooser.js |  2 +-
 lib/PluginsManager.js         |  2 +-
 lib/paramedic.js              |  2 +-
 lib/utils/utilities.js        |  6 +++---
 main.js                       | 17 ++++++++++-------
 8 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/lib/ParamedicAppUninstall.js b/lib/ParamedicAppUninstall.js
index 860532b..b5d5ec4 100644
--- a/lib/ParamedicAppUninstall.js
+++ b/lib/ParamedicAppUninstall.js
@@ -83,7 +83,7 @@ ParamedicAppUninstall.prototype.executeUninstallCommand = function (uninstallCom
                 logger.error('Error code: ' + code);
                 reject();
             }
-        }, {silent: false, async: true});
+        });
     }).timeout(60000)
     .fail(function () {
         logger.warn('cordova-paramedic: App uninstall timed out!');
diff --git a/lib/ParamedicKill.js b/lib/ParamedicKill.js
index 6ae8211..2aa0643 100644
--- a/lib/ParamedicKill.js
+++ b/lib/ParamedicKill.js
@@ -88,7 +88,7 @@ ParamedicKill.prototype.killTasks = function (taskNames) {
     logger.info('running the following command:');
     logger.info('    ' + command);
 
-    var killTasksResult = exec(command, {silent: false, async: false });
+    var killTasksResult = exec(command);
     if (killTasksResult.code !== 0) {
         console.warn('WARNING: kill command returned ' + killTasksResult.code);
     }
@@ -116,7 +116,7 @@ ParamedicKill.prototype.killAdbServer = function () {
     logger.info('Running the following command:');
     logger.info('    ' + killServerCommand);
 
-    var killServerResult = exec(killServerCommand, {silent: false, async: false});
+    var killServerResult = exec(killServerCommand);
     if (killServerResult.code !== 0) {
         logger.error('Failed killing adb server with code: ' + killServerResult.code);
     }
diff --git a/lib/ParamedicLog.js b/lib/ParamedicLog.js
index 0eee617..c676049 100644
--- a/lib/ParamedicLog.js
+++ b/lib/ParamedicLog.js
@@ -85,7 +85,7 @@ ParamedicLog.prototype.generateLogs = function (logCommand) {
     var logFile = this.getLogFileName();
     logger.info('Running Command: ' + logCommand);
 
-    var result = exec(logCommand, {silent: true, async: false});
+    var result = exec(logCommand);
     if (result.code > 0) {
         logger.error('Failed to run command: ' + logCommand);
         logger.error('Failure code: ' + result.code);
diff --git a/lib/ParamedicTargetChooser.js b/lib/ParamedicTargetChooser.js
index 25ed36a..7d66f8d 100644
--- a/lib/ParamedicTargetChooser.js
+++ b/lib/ParamedicTargetChooser.js
@@ -106,7 +106,7 @@ ParamedicTargetChooser.prototype.chooseTargetForWindows = function (emulator, ta
     var windowsCommand = this.cli + ' run --list --emulator' + util.PARAMEDIC_COMMON_CLI_ARGS;
 
     logger.info('cordova-paramedic: Running command: ' + windowsCommand);
-    var devicesResult = exec(windowsCommand, {silent: true, async: false});
+    var devicesResult = exec(windowsCommand);
     if (devicesResult.code > 0) {
         logger.error('Failed to get the list of devices for windows');
         return Q({target: undefined});
diff --git a/lib/PluginsManager.js b/lib/PluginsManager.js
index 690fc57..dc58f57 100644
--- a/lib/PluginsManager.js
+++ b/lib/PluginsManager.js
@@ -79,7 +79,7 @@ PluginsManager.prototype.installSinglePlugin = function (plugin) {
     }
 
     plugin += util.PARAMEDIC_COMMON_CLI_ARGS + util.PARAMEDIC_PLUGIN_ADD_ARGS;
-    logger.normal('cordova-paramedic: installing ' + plugin);
+    logger.normal('cordova-paramedic: installing plugin ' + plugin);
 
     var plugAddCmd = exec(this.config.getCli() + ' plugin add ' + plugin);
     if (plugAddCmd.code !== 0) {
diff --git a/lib/paramedic.js b/lib/paramedic.js
index a567ea9..5b97657 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -604,7 +604,7 @@ ParamedicRunner.prototype.packageApp = function () {
                 shell.pushd(self.getPackageFolder());
                 shell.rm('-rf', self.getPackageName());
                 console.log('Running command: ' + zipCommand + ' in dir: ' + shell.pwd());
-                exec(zipCommand, { silent: !self.config.isVerbose() }, function (code, stdout, stderr) {
+                exec(zipCommand, function (code, stdout, stderr) {
                     shell.popd();
                     if (code) {
                         reject('zip command returned with error code ' + code);
diff --git a/lib/utils/utilities.js b/lib/utils/utilities.js
index c83a31f..ba4e215 100644
--- a/lib/utils/utilities.js
+++ b/lib/utils/utilities.js
@@ -43,7 +43,7 @@ function countAndroidDevices() {
     logger.info('    ' + listCommand);
 
     var numDevices = 0;
-    var result = exec(listCommand, {silent: false, async: false});
+    var result = exec(listCommand);
     result.output.split('\n').forEach(function (line) {
         if (!HEADING_LINE_PATTERN.test(line) && DEVICE_ROW_PATTERN.test(line)) {
             numDevices += 1;
@@ -72,7 +72,7 @@ function getSimulatorModelId(cli, target) {
     logger.info('running:');
     logger.info('    ' + findSimCommand);
 
-    var findSimResult = exec(findSimCommand, {silent: true, async: false});
+    var findSimResult = exec(findSimCommand);
 
     if (findSimResult.code > 0) {
         logger.error('Failed to find simulator we deployed to');
@@ -95,7 +95,7 @@ function getSimulatorId(findSimResult) {
     logger.info('running:');
     logger.info('    ' + instrCommand);
 
-    var instrResult = exec(instrCommand, {silent: true, async: false});
+    var instrResult = exec(instrCommand);
 
     if (instrResult.code > 0) {
         logger.error('Failed to get the list of simulators');
diff --git a/main.js b/main.js
index 1b117ad..1c3a79f 100755
--- a/main.js
+++ b/main.js
@@ -26,19 +26,19 @@ var ParamedicConfig = require('./lib/ParamedicConfig');
 var util            = require('./lib/utils').utilities;
 
 var USAGE           = "Error missing args. \n" +
-    "cordova-paramedic --platform PLATFORM --plugin PATH [--justbuild --timeout MSECS --startport PORTNUM --endport PORTNUM --browserify --version]\n" +
-    "`PLATFORM` : the platform id. Currently supports 'ios', 'browser', 'windows', 'android'.\n" +
+    "\n" +
+    "cordova-paramedic --platform PLATFORM --plugin PATH [--justbuild --timeout MSECS --startport PORTNUM --endport PORTNUM --browserify --version ...]\n" +
+    "\n" +
+    "--platform PLATFORM : the platform id. Currently supports 'ios', 'browser', 'windows', 'android'.\n" +
                     "\tPath to platform can be specified as link to git repo like:\n" +
                     "\twindows@https://github.com/apache/cordova-windows.git\n" +
                     "\tor path to local copied git repo like:\n" +
                     "\twindows@../cordova-windows/\n" +
-    "`PATH` : the relative or absolute path to a plugin folder\n" +
+    "--plugin PATH : the relative or absolute path to a plugin folder\n" +
                     "\texpected to have a 'tests' folder.\n" +
                     "\tYou may specify multiple --plugin flags and they will all\n" +
                     "\tbe installed and tested together.\n" +
-    "`MSECS` : (optional) time in millisecs to wait for tests to pass|fail \n" +
-              "\t(defaults to 10 minutes) \n" +
-    "`PORTNUM` : (optional) ports to find available and use for posting results from emulator back to paramedic server(default is from 8008 to 8009)\n" +
+    "\n" +
     "--browserify : (optional) plugins are browserified into cordova.js \n" +
     "--buildName : (optional) Build name to show in Saucelabs dashboard\n" +
     "--ci : (optional) Skip tests that require user interaction\n" +
@@ -53,13 +53,16 @@ var USAGE           = "Error missing args. \n" +
     "--sauceDeviceName : (optional) Name of the SauceLabs emulator/browser. For example, \"iPhone Simulator\" or \"firefox\"\n" +
     "--sauceKey : (optional) Saucelabs access key\n" +
     "--saucePlatformVersion : (optional) Version of the emulator OS or version of the browser. For example, \"9.3\" or \"54.0\"\n" +
-    "--sauceTunnelId : (optional) Tunnel identifier to use. Only usable if you have Sauce Connect up\n"
+    "--sauceTunnelId : (optional) Tunnel identifier to use. Only usable if you have Sauce Connect up\n" + 
     "--sauceUser : (optional) Saucelabs username\n" +
     "--shouldUseSauce : (optional) run tests on Sauce Labs\n" +
     "--skipAppiumTests : (optional) Do not run Appium tests\n" +
     "--skipMainTests : (optional) Do not run main (cordova-test-framework) tests\n" +
+    "--startport/--endport `PORTNUM` : (optional) ports to find available and use for posting results from emulator back to paramedic server (default is from 8008 to 8009)\n" +
     "--target : (optional) target to deploy to\n" +
     "--tccDb : (optional) iOS only - specifies the path for the TCC.db file to be copied.\n" +
+    "--timeout `MSECS` : (optional) time in millisecs to wait for tests to pass|fail \n" +
+                "\t(defaults to 10 minutes) \n" +
     "--useTunnel: (optional) use tunneling instead of local address. default is false\n" +
     "--verbose : (optional) verbose mode. Display more information output\n" +
     "--version : (optional) prints cordova-paramedic version and exits\n" +


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org