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