Github user mmocny commented on a diff in the pull request:
https://github.com/apache/cordova-browser/pull/4#discussion_r20823674
--- 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];
+
+fs.mkdir(tmpDir);
switch (process.platform) {
+ case 'linux':
+ var args = ['--disable-web-security',
'--user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova_browser', project];
+ var chromeProcess = spawn('chrome', args);
+
+ chromeProcess.on('close', function(code) {
+ if (code != 0) {
--- End diff --
Actually, I'm not sure at all why you spawn & unref `google-chrome` but not
`chrome`. Is this intentional? Do they run differently somehow?
Also a comment about the fallback to `google-chrome` if `chrome` fails to
launch would be useful.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]