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/11/30 12:55:59 UTC
[cordova-paramedic] 01/02: Make sure all command executions output
the command
This is an automated email from the ASF dual-hosted git repository.
janpio pushed a commit to branch janpio-misc
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git
commit a3d7eed7423f082afdb47594bf3685b242393b0a
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Fri Nov 30 12:15:45 2018 +0100
Make sure all command executions output the command
---
lib/ParamedicAppUninstall.js | 3 ++-
lib/ParamedicKill.js | 5 +++--
lib/ParamedicLog.js | 3 ++-
lib/ParamedicTargetChooser.js | 3 ++-
lib/ParamediciOSPermissions.js | 2 ++
lib/appium/AppiumRunner.js | 6 +++++-
lib/paramedic.js | 4 +++-
lib/utils/utilities.js | 7 ++++---
8 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/lib/ParamedicAppUninstall.js b/lib/ParamedicAppUninstall.js
index 8188cc3..ff67030 100644
--- a/lib/ParamedicAppUninstall.js
+++ b/lib/ParamedicAppUninstall.js
@@ -23,6 +23,7 @@ var fs = require('fs');
var logger = require('./utils').logger;
var util = require('./utils').utilities;
var Q = require('q');
+var exec = require('./utils').exec;
function ParamedicAppUninstall(appPath, platform) {
this.appPath = appPath;
@@ -75,7 +76,7 @@ ParamedicAppUninstall.prototype.uninstallAppIOS = function (targetObj, app) {
ParamedicAppUninstall.prototype.executeUninstallCommand = function (uninstallCommand) {
return Q.Promise(function (resolve, reject, notify) {
logger.info('cordova-paramedic: Running command: ' + uninstallCommand);
- shelljs.exec(uninstallCommand, function (code, stdout, stderr) {
+ exec(uninstallCommand, function (code, stdout, stderr) {
if (code === 0) {
resolve();
} else {
diff --git a/lib/ParamedicKill.js b/lib/ParamedicKill.js
index 4986b3d..6ae8211 100644
--- a/lib/ParamedicKill.js
+++ b/lib/ParamedicKill.js
@@ -24,6 +24,7 @@
var shelljs = require('shelljs');
var util = require('./utils').utilities;
var logger = require('./utils').logger;
+var exec = require('./utils').exec;
function ParamedicKill(platform) {
this.platform = platform;
@@ -87,7 +88,7 @@ ParamedicKill.prototype.killTasks = function (taskNames) {
logger.info('running the following command:');
logger.info(' ' + command);
- var killTasksResult = shelljs.exec(command, {silent: false, async: false });
+ var killTasksResult = exec(command, {silent: false, async: false });
if (killTasksResult.code !== 0) {
console.warn('WARNING: kill command returned ' + killTasksResult.code);
}
@@ -115,7 +116,7 @@ ParamedicKill.prototype.killAdbServer = function () {
logger.info('Running the following command:');
logger.info(' ' + killServerCommand);
- var killServerResult = shelljs.exec(killServerCommand, {silent: false, async: false});
+ var killServerResult = exec(killServerCommand, {silent: false, async: false});
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 0cb159b..0eee617 100644
--- a/lib/ParamedicLog.js
+++ b/lib/ParamedicLog.js
@@ -28,6 +28,7 @@ var fs = require('fs');
var path = require('path-extra');
var util = require('./utils').utilities;
var logger = require('./utils').logger;
+var exec = require('./utils').exec;
function ParamedicLog(platform, appPath, outputDir, targetObj) {
this.platform = platform;
@@ -84,7 +85,7 @@ ParamedicLog.prototype.generateLogs = function (logCommand) {
var logFile = this.getLogFileName();
logger.info('Running Command: ' + logCommand);
- var result = shelljs.exec(logCommand, {silent: true, async: false});
+ var result = exec(logCommand, {silent: true, async: false});
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 6b162ad..cd7154d 100644
--- a/lib/ParamedicTargetChooser.js
+++ b/lib/ParamedicTargetChooser.js
@@ -23,6 +23,7 @@ var path = require('path-extra');
var logger = require('./utils').logger;
var util = require('./utils').utilities;
var ParamedicKill = require('./ParamedicKill');
+var exec = require('./utils').exec;
var ANDROID_RETRY_TIMES = 3;
var ANDROID_TIME_OUT = 300000; //5 Minutes
@@ -106,7 +107,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 = shelljs.exec(windowsCommand, {silent: true, async: false});
+ var devicesResult = exec(windowsCommand, {silent: true, async: false});
if (devicesResult.code > 0) {
logger.error('Failed to get the list of devices for windows');
return Q({target: undefined});
diff --git a/lib/ParamediciOSPermissions.js b/lib/ParamediciOSPermissions.js
index 646d1c0..901a5be 100644
--- a/lib/ParamediciOSPermissions.js
+++ b/lib/ParamediciOSPermissions.js
@@ -57,6 +57,7 @@ ParamediciOSPermissions.prototype.updatePermissions = function (serviceList){
logger.info('Running Command: ' + command);
// If the service has an entry already, the insert command will fail.
// in this case we'll process with updating existing entry
+ console.log('$ ' + command)
var proc = shelljs.exec(command, {silent: true, async: false});
if (proc.code) {
logger.warn('Failed to insert permissions for ' + this.appName + ' into ' + destinationTCCFile +
@@ -68,6 +69,7 @@ ParamediciOSPermissions.prototype.updatePermissions = function (serviceList){
'where service=\'%s\' and client=\'%s\'"', destinationTCCFile, serviceList[i], this.appName);
logger.info('Running Command: ' + command);
// Now we really don't care about the result as there is nothing we can do with this
+ console.log('$ ' + command)
var patchProc = shelljs.exec(command, {silent: true, async: false});
if (patchProc.code) {
logger.warn('Failed to update existing permissions for ' + this.appName + ' into ' + destinationTCCFile +
diff --git a/lib/appium/AppiumRunner.js b/lib/appium/AppiumRunner.js
index e647ee7..ac1e796 100644
--- a/lib/appium/AppiumRunner.js
+++ b/lib/appium/AppiumRunner.js
@@ -41,6 +41,7 @@ var Reporters = require('../Reporters');
var execPromise = require('../utils').execPromise;
var Reporters = require('../Reporters');
var portChecker = require('tcp-port-used');
+var exec = require('../utils').exec;
var SMALL_BUFFER_SIZE = 1024 * 1024;
var BIG_BUFFER_SIZE = 50 * 1024 * 1024;
@@ -111,7 +112,7 @@ function runCommand(command, appPath) {
if (appPath) {
shell.pushd(appPath);
}
- shell.exec(command);
+ exec(command);
if (appPath) {
shell.popd();
}
@@ -240,6 +241,7 @@ AppiumRunner.prototype.startIosProxy = function () {
logger.normal('paramedic-appium: Running:');
logger.normal('paramedic-appium: ' + iosProxyCommand);
self.iosProxy.alive = true;
+ console.log('$ ' + iosProxyCommand)
self.iosProxy.process = child_process.exec(iosProxyCommand, { maxBuffer: BIG_BUFFER_SIZE }, function () {
self.iosProxy.alive = false;
logger.normal('paramedic-appium: iOS proxy process exited.');
@@ -279,6 +281,7 @@ AppiumRunner.prototype.startAppiumServer = function () {
logger.normal('paramedic-appium: Running:');
logger.normal('paramedic-appium: ' + appiumServerCommand);
self.appium.alive = true;
+ console.log('$ ' + appiumServerCommand)
self.appium.process = child_process.exec(appiumServerCommand, { maxBuffer: BIG_BUFFER_SIZE }, function (error) {
logger.normal('paramedic-appium: Appium process exited.');
if (self.appium.alive && error) {
@@ -382,6 +385,7 @@ AppiumRunner.prototype.prepareApp = function () {
// rebuild the app
logger.normal('paramedic-appium: Building the app...');
+ console.log('$ ' + buildCommand)
child_process.exec(buildCommand, { cwd: fullAppPath, maxBuffer: SMALL_BUFFER_SIZE }, function (error, stdout, stderr) {
if (error || stdout.indexOf('BUILD FAILED') >= 0 || stderr.indexOf('BUILD FAILED') >= 0) {
d.reject('Couldn\'t build the app: ' + error);
diff --git a/lib/paramedic.js b/lib/paramedic.js
index 9bc7a26..a74e142 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -337,6 +337,7 @@ ParamedicRunner.prototype.runLocalTests = function () {
if (self.config.getPlatformId() !== util.BROWSER) {
return execPromise(command);
}
+ console.log('$ ' + command)
runProcess = cp.exec(command, function () {
// a precaution not to try to kill some other process
runProcess = null;
@@ -594,7 +595,7 @@ ParamedicRunner.prototype.packageApp = function () {
shell.pushd(self.getPackageFolder());
shell.rm('-rf', self.getPackageName());
console.log('Running command: ' + zipCommand + ' in dir: ' + shell.pwd());
- shell.exec(zipCommand, { silent: !self.config.isVerbose() }, function (code, stdout, stderr) {
+ exec(zipCommand, { silent: !self.config.isVerbose() }, function (code, stdout, stderr) {
shell.popd();
if (code) {
reject('zip command returned with error code ' + code);
@@ -936,6 +937,7 @@ ParamedicRunner.prototype.runSauceTests = function () {
return self.getCommandForStartingTests();
})
.then(function (command) {
+ console.log('$ ' + command)
runProcess = cp.exec(command, function onExit() {
// a precaution not to try to kill some other process
runProcess = null;
diff --git a/lib/utils/utilities.js b/lib/utils/utilities.js
index a2c7fbb..45a85a1 100644
--- a/lib/utils/utilities.js
+++ b/lib/utils/utilities.js
@@ -26,6 +26,7 @@ var util = require('util');
var path = require('path-extra');
var logger = require('cordova-common').CordovaLogger.get();
var kill = require('tree-kill');
+var exec = require('./execWrapper').exec
var HEADING_LINE_PATTERN = /List of devices/m;
var DEVICE_ROW_PATTERN = /(emulator|device|host)/m;
@@ -43,7 +44,7 @@ function countAndroidDevices() {
logger.info(' ' + listCommand);
var numDevices = 0;
- var result = shelljs.exec(listCommand, {silent: false, async: false});
+ var result = exec(listCommand, {silent: false, async: false});
result.output.split('\n').forEach(function (line) {
if (!HEADING_LINE_PATTERN.test(line) && DEVICE_ROW_PATTERN.test(line)) {
numDevices += 1;
@@ -72,7 +73,7 @@ function getSimulatorModelId(cli, target) {
logger.info('running:');
logger.info(' ' + findSimCommand);
- var findSimResult = shelljs.exec(findSimCommand, {silent: true, async: false});
+ var findSimResult = exec(findSimCommand, {silent: true, async: false});
if (findSimResult.code > 0) {
logger.error('Failed to find simulator we deployed to');
@@ -95,7 +96,7 @@ function getSimulatorId(findSimResult) {
logger.info('running:');
logger.info(' ' + instrCommand);
- var instrResult = shelljs.exec(instrCommand, {silent: true, async: false});
+ var instrResult = exec(instrCommand, {silent: true, async: false});
if (instrResult.code > 0) {
logger.error('Failed to get the list of simulators');
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org