mirror of
https://github.com/docker/compose.git
synced 2026-08-27 03:45:29 +00:00
Handle Ctrl+C for compose CLI plugin.
Could do something nicer passing the context to the compose command, rather than intercepting it and checking if it’s “.WithCancel” or not... Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
parent
0785114b90
commit
de3fa40bae
5 changed files with 124 additions and 1 deletions
|
|
@ -252,6 +252,18 @@ func (c *E2eCLI) WaitForCmdResult(command icmd.Cmd, predicate func(*icmd.Result)
|
|||
poll.WaitOn(c.test, checkStopped, poll.WithDelay(delay), poll.WithTimeout(timeout))
|
||||
}
|
||||
|
||||
// WaitForCondition wait for predicate to execute to true
|
||||
func (c *E2eCLI) WaitForCondition(predicate func() (bool, string), timeout time.Duration, delay time.Duration) {
|
||||
checkStopped := func(logt poll.LogT) poll.Result {
|
||||
pass, description := predicate()
|
||||
if !pass {
|
||||
return poll.Continue("Condition not met: %q", description)
|
||||
}
|
||||
return poll.Success()
|
||||
}
|
||||
poll.WaitOn(c.test, checkStopped, poll.WithDelay(delay), poll.WithTimeout(timeout))
|
||||
}
|
||||
|
||||
// PathEnvVar returns path (os sensitive) for running test
|
||||
func (c *E2eCLI) PathEnvVar() string {
|
||||
path := c.BinDir + ":" + os.Getenv("PATH")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue