Merge pull request #1710 from ijc/no-dial-stdio-on-windows

Disable `docker system dial-stdio` on Windows
This commit is contained in:
Silvin Lubecki 2019-03-11 15:14:23 +01:00 committed by GitHub
commit b86bff84b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"os" "os"
"runtime"
"sync" "sync"
"github.com/docker/cli/cli" "github.com/docker/cli/cli"
@ -74,7 +75,11 @@ func PersistentPreRunE(cmd *cobra.Command, args []string) error {
} }
// flags must be the original top-level command flags, not cmd.Flags() // flags must be the original top-level command flags, not cmd.Flags()
options.opts.Common.SetDefaultOptions(options.flags) options.opts.Common.SetDefaultOptions(options.flags)
err = options.dockerCli.Initialize(options.opts, withPluginClientConn(options.name)) var initopts []command.InitializeOpt
if runtime.GOOS != "windows" {
initopts = append(initopts, withPluginClientConn(options.name))
}
err = options.dockerCli.Initialize(options.opts, initopts...)
}) })
return err return err
} }

View File

@ -1,6 +1,8 @@
package system package system
import ( import (
"runtime"
"github.com/docker/cli/cli" "github.com/docker/cli/cli"
"github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -19,8 +21,12 @@ func NewSystemCommand(dockerCli command.Cli) *cobra.Command {
NewInfoCommand(dockerCli), NewInfoCommand(dockerCli),
newDiskUsageCommand(dockerCli), newDiskUsageCommand(dockerCli),
newPruneCommand(dockerCli), newPruneCommand(dockerCli),
newDialStdioCommand(dockerCli),
) )
if runtime.GOOS != "windows" {
cmd.AddCommand(
newDialStdioCommand(dockerCli),
)
}
return cmd return cmd
} }