i do not think goroutine is needed here you can just simply read the data from stdout of the subprocess  in case of timeout  the process should be killed  thanks to the goroutine in testexec cmd start and the input will be terminated you can just returns the result 