diff --git a/path_windows_test.go b/path_windows_test.go index 59d4053..28c7190 100644 --- a/path_windows_test.go +++ b/path_windows_test.go @@ -15,7 +15,7 @@ func TestGetRealPath(t *testing.T) { }{ { "Test Windows Path", - "C:\\Users\\appleboy\\test.txt", + args{"C:\\Users\\appleboy\\test.txt"}, "/C/Users/appleboy/test.txt", }, } diff --git a/plugin.go b/plugin.go index 5e3faa6..7a729f8 100644 --- a/plugin.go +++ b/plugin.go @@ -147,7 +147,7 @@ func (p *Plugin) removeAllDestFile() error { }, } - _, _, _, err := ssh.Run("ver", p.Config.CommandTimeout) + _, _, _, err := ssh.Run("cmd /c ver 2>$null", p.Config.CommandTimeout) systemType := "unix" if err == nil { systemType = "windows" @@ -292,7 +292,7 @@ func (p *Plugin) Exec() error { } systemType := "unix" - _, _, _, err := ssh.Run("ver", p.Config.CommandTimeout) + _, _, _, err := ssh.Run("cmd /c ver 2>$null", p.Config.CommandTimeout) if err == nil { systemType = "windows" } diff --git a/plugin_test.go b/plugin_test.go index 3e16056..b1bbfdf 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -571,7 +571,7 @@ func TestRemoveDestFile(t *testing.T) { DestFile: "/etc/resolv.conf", } - _, _, _, err := ssh.Run("ver", plugin.Config.CommandTimeout) + _, _, _, err := ssh.Run("cmd /c ver 2>$null", plugin.Config.CommandTimeout) systemType := "unix" if err == nil { systemType = "windows"