From 7f5e21c4a0bd2b817baeeeaa1b6a1d81d8c93c8d Mon Sep 17 00:00:00 2001 From: Ivan Milchev Date: Tue, 15 Oct 2024 15:09:48 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20more=20windows=20error=20handlin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ivan Milchev --- providers/os/resources/processes/ps1getprocess.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/providers/os/resources/processes/ps1getprocess.go b/providers/os/resources/processes/ps1getprocess.go index 6ee1c41596..7ea6e6ef74 100644 --- a/providers/os/resources/processes/ps1getprocess.go +++ b/providers/os/resources/processes/ps1getprocess.go @@ -156,6 +156,14 @@ func (wpm *WindowsProcessManager) List() ([]*OSProcess, error) { return nil, fmt.Errorf("processes> could not run command") } + if c.ExitStatus != 0 { + stderr, err := io.ReadAll(c.Stderr) + if err != nil { + return nil, err + } + return nil, errors.New("failed to retrieve process list: " + string(stderr)) + } + entries, err := ParseWindowsProcesses(c.Stdout) if err != nil { return nil, err