go-autostart
go-autostart copied to clipboard
Windows doesn't support spaces in arguments
Qute is also a bad idea because it produces exploding amount of escaped quotes
Well, at least quoting works, just putting spaces doesn't. win32's SetArguments only accepts strings, so there aren't a lot of solutions.
quoting doesn't work, we have tested it with single argument on windows 10
My bad, I though it worked. That's strange, maybe only quoting arguments that contain a space can solve this issue?
Yah, that should work. I will test it and pull request if it helps
There is no need to quote the arguments. I tested windows 7,10 and both are accepting arguments with spaces. Only the path to executable should be quoted if contain spaces and this is already treated properly.
I don't think so. args is a string of space-separated arguments.
yes, but the windows will send all arguments to go program and urfave/cli will handle this
e.g. --log-level=debug works as well as --log-level debug
When I talk about spaces in arguments, I talk about something like --display-name="Mitsuha Miyamizu". I don't want this to become two arguments (--display-name="Mitsuha and Miyamizu"). This looks like this when calling the library:
args := []string{"--log-level", "debug", "--display-name", "Mitsuha Miyamizu"}
I think the arguments should be used like this
args := []string{"--log-level", "debug", "--display-name", "\"Mitsuha Miyamizu\""}
and the users should think about this.
and the users should think about this
Nope, for two reasons. First, arguments in a []string are expected by users to be escaped properly, because it's done like this in the standard library. This is also a safeguard against security issues if library users forget this edge case (arguments could be strings entered by the app user).
Also, the macOS actually uses a config file like this:
<argument>--log-level</argument>
<argument>debug</argument>
<argument>--display-name</argument>
<argument>"Mitsuha Miyamizu"</argument>
And the program will be spawned with --log-level debug --display-name "\"Mitsuha Miyamizu\"" (so the last argument value becomes "Mitsuha Miyamizu" instead of Mitsuha Miyamizu).