From 765ab2b6921b1a6f21504d0c4ef4eed046a76d89 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 27 Apr 2016 13:08:20 -0400 Subject: [PATCH] Raise a more relevant error when dockerd is not available on the platform. Signed-off-by: Daniel Nephin --- daemon_windows.go => daemon_none.go | 7 ++++++- daemon_windows_test.go => daemon_none_test.go | 4 +++- daemon_unix.go | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) rename daemon_windows.go => daemon_none.go (55%) rename daemon_windows_test.go => daemon_none_test.go (80%) diff --git a/daemon_windows.go b/daemon_none.go similarity index 55% rename from daemon_windows.go rename to daemon_none.go index 41c0133b67..d66bf1a546 100644 --- a/daemon_windows.go +++ b/daemon_none.go @@ -1,11 +1,16 @@ +// +build !daemon + package main import ( "fmt" + "runtime" + "strings" ) // CmdDaemon reports on an error on windows, because there is no exec func (p DaemonProxy) CmdDaemon(args ...string) error { return fmt.Errorf( - "`docker daemon` does not exist on windows. Please run `dockerd` directly") + "`docker daemon` is not supported on %s. Please run `dockerd` directly", + strings.Title(runtime.GOOS)) } diff --git a/daemon_windows_test.go b/daemon_none_test.go similarity index 80% rename from daemon_windows_test.go rename to daemon_none_test.go index 3da4e5d7cc..d75453bcc5 100644 --- a/daemon_windows_test.go +++ b/daemon_none_test.go @@ -1,3 +1,5 @@ +// +build !daemon + package main import ( @@ -9,7 +11,7 @@ func TestCmdDaemon(t *testing.T) { proxy := NewDaemonProxy() err := proxy.CmdDaemon("--help") if err == nil { - t.Fatal("Expected CmdDaemon to fail in Windows.") + t.Fatal("Expected CmdDaemon to fail on Windows.") } if !strings.Contains(err.Error(), "Please run `dockerd`") { diff --git a/daemon_unix.go b/daemon_unix.go index 896782b36c..7a27518636 100644 --- a/daemon_unix.go +++ b/daemon_unix.go @@ -1,4 +1,4 @@ -// +build !windows +// +build daemon package main