cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sosahvictor <>
Subject [GitHub] cordova-browser pull request: CB-7978 Fixed launching chrome in Li...
Date Mon, 24 Nov 2014 22:40:15 GMT
Github user sosahvictor commented on a diff in the pull request:
    --- Diff: bin/templates/project/cordova/run ---
    @@ -20,10 +20,33 @@
     var shell = require('shelljs'),
    -    spawn = require('child_process').spawn,
    -    project = 'file://' + shell.pwd() + '/platforms/browser/www/index.html';
    +	fs = require('fs');
    +var configFile = shell.pwd() + '/config.xml';
    +var configXML = fs.readFileSync(configFile, 'utf8');
    +var sourceFile = /<content[\s\S]*?src\s*=\s*"(.*?)"/i.exec(configXML);	
    +var spawn = require('child_process').spawn,
    +    tmpDir = '/tmp/temp_chrome_user_data_dir_for_cordova_browser/',
    +    project = 'file://' + shell.pwd() + '/platforms/browser/www/' + sourceFile[1];
     switch (process.platform) {
    +  case 'linux':
    +  	var args = ['--disable-web-security', '--user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova_browser',
    +  	var chromeProcess = spawn('chrome', args);
    +  	chromeProcess.on('close', function(code) {
    +  		if (code != 0) {
    --- End diff --
    You are right, something I didn't notice at that time. The `google-chrome` process is
detached, so if the user wants to keep using Cordova CLI for other tasks he can do it, but
this is not the same as for `chrome` process.
    Moreover, the other platforms (Mac and Windows) don't have a handler like the one in Linux
I'm proposing. My question to you is, should I get rid of the `unref` and let the child process
block the parent (and hence the user won't be able to use the CLI until he/she closes chrome)
or unify the behavior for other platforms as well? Keep in mind that the change will affect
other platforms, not just Linux as in this PR

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message