cmd
cmd copied to clipboard
Why status.Stdout is empty in my code
func main() {
findCmd := cmd.NewCmd("dir")
statusChan := findCmd.Start()
go func() {
for {
fmt.Println("-------")
status := findCmd.Status()
fmt.Println(status.Stdout)
}
}()
<-statusChan
fmt.Println("=======")
}
I run this program on Win10, and get something like that:
-------
[]
-------
[]
-------
[]
-------
[]
-------
[]
-------
[]
-------
[]
So, what's the problem of it.
OK, I find the problem, command "dir" is not work, but "go env" get outputs, I haven't watched or tested inner code, but I think it maybe is a problem.
also cant get dir to work, guessing module is a bit borked?