Skip to content

Commit cfd5b16

Browse files
Merge pull request #1745 from ijc/disable-dial-stdio-for-plugins
cli-plugins: disable use of dial-stdio
2 parents 86a5a48 + ff2ed6e commit cfd5b16

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cli-plugins/plugin/plugin.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ func runPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager
3131
PersistentPreRunE = func(_ *cobra.Command, _ []string) error {
3232
var err error
3333
persistentPreRunOnce.Do(func() {
34-
err = tcmd.Initialize(withPluginClientConn(plugin.Name()))
34+
var opts []command.InitializeOpt
35+
if os.Getenv("DOCKER_CLI_PLUGIN_USE_DIAL_STDIO") != "" {
36+
opts = append(opts, withPluginClientConn(plugin.Name()))
37+
}
38+
err = tcmd.Initialize(opts...)
3539
})
3640
return err
3741
}

e2e/cli-plugins/dial_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import (
1111
"gotest.tools/icmd"
1212
)
1313

14-
func TestDialStdio(t *testing.T) {
14+
func TestCLIPluginDialStdio(t *testing.T) {
15+
if os.Getenv("DOCKER_CLI_PLUGIN_USE_DIAL_STDIO") == "" {
16+
t.Skip("skipping plugin dial-stdio test since DOCKER_CLI_PLUGIN_USE_DIAL_STDIO is not set")
17+
}
18+
1519
// Run the helloworld plugin forcing /bin/true as the `system
1620
// dial-stdio` target. It should be passed all arguments from
1721
// before the `helloworld` arg, but not the --who=foo which

0 commit comments

Comments
 (0)