Just tried it out, unfortunately, it keeps having the same error, even if I 
apply this format to the rest of the arguments


El jueves, 21 de marzo de 2019, 13:46:29 (UTC-3), Jake Montgomery escribió:
>
> It is likely that the spaces before the command line arguments is 
> confusing the Chrome parser. Try removing them for every item in Args, and 
> it may work. 
>
> On a style note, I would use:
>
> AppCommand:=
> `C:\Users\User\AppData\Local\Google\Chrome\Application\chrome.exe`
>
>  instead of:
>
> AppCommand:=
> "C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"
>
>
>
>
>
> On Thursday, March 21, 2019 at 12:13:52 PM UTC-4, XXX ZZZ wrote:
>>
>> Hello,
>>
>> I'm trying to launch Chrome from Go under windows, some of the arguments 
>> I'm passing have custom paths in it and it seems that go is sanitizing 
>> these arguments and not recognizing the paths. Basically it seems to be 
>> appending the application path into the arguments with a path.
>>
>> Code is as follows:
>>
>> package main
>>
>> import(
>>     "os/exec"
>>     "fmt"
>> )
>>
>> func main(){
>>     fmt.Printf("Trying to start Chrome\n")
>>
>>     
>> AppCommand:="C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"
>>     Args:=[]string{" --user-data-dir=\"C:\\ProfileTest 1\"",
>>     " --load-extension=\"C:\\test\"",
>>     " --disk-cache-dir=\"C:\\profileCache\"",
>>     " --disable-preconnect",
>>     " --dns-prefetch-disable",
>>     " --start-maximized",
>>     " --allow-insecure-localhost",
>>     " --ignore-certificate-errors",
>>     " --ignore-certificate-errors-spki-list",
>>     " --no-default-browser-check",
>>     " --disable-infobars"}
>>
>>     cmd := exec.Command(AppCommand,  Args...)
>>     //stdout, err := cmd.Output()
>>     if err := cmd.Start(); err != nil {
>>         fmt.Printf("Start Chrome error %+v\n", err)
>>         continue
>>     }
>> }
>>
>> At chrome, we noticed that the load-extension path is being appended 
>> with: "C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\Application\\" so 
>> it ends up with: 
>> "C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\Application\\""C:\\test", 
>> same goes for the other arguments with a path.
>>
>> Is there any way to tell go to avoid doing this? Maybe just executing a 
>> command straight from a command line?
>>
>> Thanks.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to