You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If for some reason a BeforeExec takes some time (to delay a command for example) and Stop() is called while BeforeExec hasn't finished, the command is still executed.
Would it make sense to add a ForceStop() function like:
// ForceStop forces a command stop by calling Stop(). If the command hasn't// started yet flags it as stopped to prevent Start() from starting it.//// See Stop() for further detailsfunc (c*Cmd) ForceStop() error {
err:=c.Stop()
// If command hasn't started, return error (or nil) from Stop()iferr!=ErrNotStarted {
returnerr
}
// flag command as stopped to prevent it from being started later.c.stopped=truereturnnil
}
Thanks in advance
The text was updated successfully, but these errors were encountered:
If for some reason a
BeforeExec
takes some time (to delay a command for example) andStop()
is called whileBeforeExec
hasn't finished, the command is still executed.Example:
Output:
Stop()
has no effect if command is not started because ofcmd/cmd.go
Lines 290 to 297 in fa11d77
run()
runs allBeforeExec
functions and starts the command (cmd/cmd.go
Lines 431 to 448 in fa11d77
Would it make sense to add a
ForceStop()
function like:Thanks in advance
The text was updated successfully, but these errors were encountered: