Yes. The problem is that when the context passed to CommandContext
expires, it kills the process started by the command, but does not
kill any subprocesses that that command may have started. So when the
context expires the /bin/sh is killed, but the sleep subprocess is
still running. Because you use a bytes.Buffer, the program has
created a pipe to capture the standard output of the command. After
the process dies, cmd.Run is waiting for that pipe to be closed to
make sure that it gathers all the data. But the pipe is held open by
the sleep subprocess. It is only after that subprocess exits that the
pipe is closed and your program continues.
Ian