mirror of https://github.com/docker/cli.git
Merge pull request #1745 from ijc/disable-dial-stdio-for-plugins
cli-plugins: disable use of dial-stdio
This commit is contained in:
commit
cfd5b16ae0
|
@ -31,7 +31,11 @@ func runPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager
|
||||||
PersistentPreRunE = func(_ *cobra.Command, _ []string) error {
|
PersistentPreRunE = func(_ *cobra.Command, _ []string) error {
|
||||||
var err error
|
var err error
|
||||||
persistentPreRunOnce.Do(func() {
|
persistentPreRunOnce.Do(func() {
|
||||||
err = tcmd.Initialize(withPluginClientConn(plugin.Name()))
|
var opts []command.InitializeOpt
|
||||||
|
if os.Getenv("DOCKER_CLI_PLUGIN_USE_DIAL_STDIO") != "" {
|
||||||
|
opts = append(opts, withPluginClientConn(plugin.Name()))
|
||||||
|
}
|
||||||
|
err = tcmd.Initialize(opts...)
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,11 @@ import (
|
||||||
"gotest.tools/icmd"
|
"gotest.tools/icmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDialStdio(t *testing.T) {
|
func TestCLIPluginDialStdio(t *testing.T) {
|
||||||
|
if os.Getenv("DOCKER_CLI_PLUGIN_USE_DIAL_STDIO") == "" {
|
||||||
|
t.Skip("skipping plugin dial-stdio test since DOCKER_CLI_PLUGIN_USE_DIAL_STDIO is not set")
|
||||||
|
}
|
||||||
|
|
||||||
// Run the helloworld plugin forcing /bin/true as the `system
|
// Run the helloworld plugin forcing /bin/true as the `system
|
||||||
// dial-stdio` target. It should be passed all arguments from
|
// dial-stdio` target. It should be passed all arguments from
|
||||||
// before the `helloworld` arg, but not the --who=foo which
|
// before the `helloworld` arg, but not the --who=foo which
|
||||||
|
|
Loading…
Reference in New Issue