From c250f8d88c9a5f3e4d0fab8be9e32b3241ebf05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Krzy=C5=BCowski?= Date: Sun, 17 Aug 2025 16:51:08 +0200 Subject: [PATCH 1/2] fix: resolve compilation error in path_windows_test.go Fixed test case structure where string was passed directly instead of being wrapped in args struct, which caused build failure. --- path_windows_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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", }, } From 3a7e69a856db3df42edc323b364b755b41a4d557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Krzy=C5=BCowski?= Date: Sun, 17 Aug 2025 16:57:45 +0200 Subject: [PATCH 2/2] fix: update remote system detection command for Windows compatibility The current Windows system detection uses a simple `ver` command which fails on Windows servers where PowerShell is configured as the default SSH shell. The `ver` command is only available in CMD, not in PowerShell, causing system detection to fail incorrectly. --- plugin.go | 4 ++-- plugin_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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"