Skip to content

Commit

Permalink
🐛 consistent processes executable for unix and linux
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <ivan@mondoo.com>
  • Loading branch information
imilchev committed Nov 29, 2024
1 parent 4ea1de3 commit 5923faf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions providers/os/resources/processes/unixps.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,17 @@ type ProcessEntry struct {
}

func (p ProcessEntry) ToOSProcess() *OSProcess {
executable := ""
executablePath := ""
args, err := shellquote.Split(p.Command)
if err == nil && len(args) > 0 {
executable = args[0]
executablePath = args[0]
}

executablePathParts := strings.Split(executablePath, "/")
return &OSProcess{
Pid: p.Pid,
Command: p.Command,
Executable: executable,
Executable: executablePathParts[len(executablePathParts)-1],
State: "",
}
}
Expand Down

0 comments on commit 5923faf

Please sign in to comment.