问题 I'm trying to start a command in a detached process so that it can continue after go program exits. I need to redirect the output of the command to a file. What I need is something like this: func main() { command := exec.Command("/tmp/test.sh", ">", "/tmp/out") if err := command.Start(); err != nil { fmt.Fprintln(os.Stderr, "Command failed.", err) os.Exit(1) } fmt.Println("Process ID:", command.Process.Pid) } Obviously such redirect doesn't work. As I immediately exit from the program after