使用Golang Exec执行Tmux

I want to execute a tmux session using Golang. I'm able to compile and get an exit status 1.

cmd := exec.Command("tmux", "new", "-s", "foo")
err := cmd.Run()
if err != nil {
  log.Fatal(err)
}

I want to start a session. At the very least, I want to get a more tangible error. Any docs to refer me to? I couldn't find much on the Tmux manual pages. I think I'm missing a command.

You need to connect tmux to your terminal. Try to add these lines after cmd initialization:

    cmd.Stdin = os.Stdin
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr

UPDATE: link to the playground