mirror of
https://github.com/docker/compose.git
synced 2025-07-24 22:24:41 +02:00
Merge pull request #1062 from gtardif/fix_cli_moby_command_detect
Make Moby command detection (based on help output) more robust.
This commit is contained in:
commit
10a19b1159
@ -22,7 +22,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"strings"
|
"regexp"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
@ -112,9 +112,7 @@ func IsDefaultContextCommand(dockerCommand string) bool {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
fmt.Println(e)
|
fmt.Println(e)
|
||||||
}
|
}
|
||||||
output := string(b)
|
return regexp.MustCompile("Usage:\\s*docker\\s*" + dockerCommand).Match(b)
|
||||||
contains := strings.Contains(output, "Usage:\tdocker "+dockerCommand)
|
|
||||||
return contains
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecSilent executes a command and do redirect output to stdOut, return output
|
// ExecSilent executes a command and do redirect output to stdOut, return output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user