cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject cordova-windows git commit: CB-9097 fail with a more descriptive error if run as admin
Date Tue, 02 Jun 2015 23:27:41 GMT
Repository: cordova-windows
Updated Branches:
  refs/heads/master ed04ee117 -> b34a5f119


CB-9097 fail with a more descriptive error if run as admin


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/b34a5f11
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/b34a5f11
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/b34a5f11

Branch: refs/heads/master
Commit: b34a5f1194deeeb0bc1699f91ba3678fd2cee445
Parents: ed04ee1
Author: Murat Sutunc <sutunc@gmail.com>
Authored: Fri May 29 11:00:26 2015 -0700
Committer: Murat Sutunc <sutunc@gmail.com>
Committed: Fri May 29 11:04:37 2015 -0700

----------------------------------------------------------------------
 template/cordova/lib/run.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/b34a5f11/template/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/run.js b/template/cordova/lib/run.js
index 36ddf0c..ddc7737 100644
--- a/template/cordova/lib/run.js
+++ b/template/cordova/lib/run.js
@@ -23,7 +23,8 @@ var Q = require('q'),
     build = require('./build'),
     utils = require('./utils'),
     ConfigParser = require('./ConfigParser'),
-    packages = require('./package');
+    packages = require('./package'),
+    execSync = require('child_process').execSync;
 
 var ROOT = path.join(__dirname, '..', '..');
 
@@ -32,6 +33,13 @@ module.exports.run = function (argv) {
         return Q.reject('Could not find project at ' + ROOT);
     }
 
+    try {
+        // Check if ran from admin prompt and fail quickly if CLI has administrative permissions
+        // http://stackoverflow.com/a/11995662/64949
+        execSync('net session', {'stdio': 'ignore'});
+        return Q.reject('Can not run this platform with administrative permissions. Please
run from a non-admin prompt.');
+    } catch (e) {}
+
     // parse arg
     var args  = nopt({'debug': Boolean, 'release': Boolean, 'nobuild': Boolean,
         'device': Boolean, 'emulator': Boolean, 'target': String, 'archs': String,


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


Mime
View raw message