You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2015/09/15 14:26:34 UTC

cordova-browser git commit: CB-9658 Improve 'cordova run browser' when browser not installed.

Repository: cordova-browser
Updated Branches:
  refs/heads/master 62b72ca7a -> e467d6a56


CB-9658 Improve 'cordova run browser' when browser not installed.

Instead of allowing the exception to fall through and get output with its stack trace, catche the error and output just the error message.


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

Branch: refs/heads/master
Commit: e467d6a56f7e83539f6eef90e7023169c0de1735
Parents: 62b72ca
Author: Tim Barham <ti...@microsoft.com>
Authored: Tue Sep 15 17:09:22 2015 +1000
Committer: Tim Barham <ti...@microsoft.com>
Committed: Tue Sep 15 17:16:18 2015 +1000

----------------------------------------------------------------------
 bin/templates/project/cordova/run | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/e467d6a5/bin/templates/project/cordova/run
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/run b/bin/templates/project/cordova/run
index c0e9c1e..092e764 100755
--- a/bin/templates/project/cordova/run
+++ b/bin/templates/project/cordova/run
@@ -44,11 +44,19 @@ function start(argv) {
         configXML = fs.readFileSync(configFile, 'utf8'),
         sourceFile = /<content[\s]+?src\s*=\s*"(.*?)"/i.exec(configXML);
 
+    var server;
+
     serve.servePlatform('browser', {port: args.port, noServerInfo: true}).then(function (serverInfo) {
+        server = serverInfo.server;
         var projectUrl = url.resolve('http://localhost:' + serverInfo.port + '/', sourceFile ? sourceFile[1] : 'index.html');
         console.log('Static file server running @ ' + projectUrl + '\nCTRL + C to shut down');
         return serve.launchBrowser({target: args.target, url: projectUrl});
-    }).done();
+    }).catch(function (error) {
+        console.log(error.message || error.toString());
+        if (server) {
+            server.close();
+        }
+    });
 }
 
 function help() {


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