[
https://issues.apache.org/jira/browse/CB-7978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14223683#comment-14223683
]
ASF GitHub Bot commented on CB-7978:
------------------------------------
Github user sosahvictor commented on a diff in the pull request:
https://github.com/apache/cordova-browser/pull/4#discussion_r20828724
--- 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 --
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
> Can't run browser platform on Linux
> -----------------------------------
>
> Key: CB-7978
> URL: https://issues.apache.org/jira/browse/CB-7978
> Project: Apache Cordova
> Issue Type: Bug
> Components: Browser
> Affects Versions: 4.0.0
> Environment: Linux
> Reporter: Victor Adrian Sosa Herrera
>
> Command "cordova run browser" doesn't work on Linux. The run command handles
> the cases of when using Windows and Darwin (MacOS) but no Linux.
> Moreover, I have Chrome installed in my machine, but it doesn't respond to
> the typical "chrome" command because I get an error in the standard
> output[1], so I have to use "google-chrome" command to launch it
> One more thing I noticed is that in the run script of the browser platform,
> it is directly pointing to "www/index.html", instead of reading config.xml
> file looking for <content src="HTMLPage.html">
> [1] Error
> chrome: error while loading shared libraries: libudev.so.0: cannot open
> shared object file: No such file or directory
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]