runc容器启动golang分离模式

I'm testing runc container start time using an automatic go lang script my code is like below and it keep blocking the process even that it runs without blocking in shell.

    command := exec.Command("runc","start","-d","redis")
    command.Dir = "/containers/redis"
    start := time.Now() 
    r,err:=command.CombinedOutput()
    duration:= time.Since(start)/time.Millisecond
    fmt.Println(duration)   
    fmt.Println(err) 
    fmt.Println(string(r))

When you start a subprocess from sh, it waits for the child process to exit (using something like waitpid()), and then immediately returns. The stdout and stderr of the subprocess (and all its children) will be written directly to your terminal (not via sh), even after sh has returned to the prompt. This is also what .Start() would do.

When you use .CombinedOutput(), you wait until the stdout and stderr of the started process (and all subprocesses that inherit it) get closed. Even if your immediate child process (runc start) exits, the container it starts might still have a copy of the stdout and stderr and be writing to them, so .CombinedOutput() can't return until it's sure all copies of those files are closed.