juj/emrun

`--browser_args` is broken

Closed this issue · 1 comments

Sorry to open this issue, but --browser_args turns of to be problematic.

In emscripten-core/emscripten#5901 I passed -headless to --browser_args and this worked with optparse. This was because optparse didn't support tar -xvf style argument so it thought -headless is not an argument name but a value for --browser_args.

Now after #7, argparse supports and reads -headless as -h -e -a -d -l -e -s -s instead of an argument value, which is problematic. Quoting doesn't work as --browser_args '-headless' is same as --browser_args -headless. Anything starts with - is now a parameter name.

I think we can:

  1. force including a leading space on --browser_args: --browser_args " -headless" and ignore empty strings in the results.
  2. force double quote: --browser_args "'-headless'". This requires manual unquoting.
  3. deprecate --browser_args and introduce --browser_cmd which includes full command.
juj commented

Perhaps we can manually parse out --browser_args from the cmdline up front before passing the rest of the cmdline to argparse? If single or double quotes provide a problem, we could take up a manual syntax, such as --browser_args=(-headless -param2 someparam3) for this to use?