-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os/exec: can add WaitTimeout(timeout time.Duration) bool for exec.Cmd #9580
Comments
|
Or how about to use var timer *time.Timer
timer = time.AfterFunc(3 * time.Second, func() {
timer.Stop()
cmd.Process.Kill()
}) |
@mattn it is very good. |
@mattn The approach is reasonable but I don't think you need to stop the timer when it fires (it
You can tell if the cmd was killed by looking at err, or (with high probabilty The disadvantage of this approach is that sometimes a process The advantage is that it's possible to read from StdoutPipe |
exec: can add WaitTimeout(timeout time.Duration) error for exec.Cmd.
example is:
The text was updated successfully, but these errors were encountered: