Skip to content

Commit

Permalink
Command line can be nil in Win32_Process (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano authored Nov 15, 2018
1 parent 56cb7e1 commit f498c67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Added missing runtime import for FreeBSD. #104
- Handle nil command line in Windows processes. #110

### Changed

Expand Down
6 changes: 4 additions & 2 deletions sigar_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
// automatically be populated when calling getWin32Process.
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa394372(v=vs.85).aspx
type Win32_Process struct {
CommandLine string
CommandLine *string
}

// Win32_OperatingSystem WMI class represents a Windows-based operating system
Expand Down Expand Up @@ -376,8 +376,10 @@ func (self *ProcArgs) Get(pid int) error {
if err != nil {
return errors.Wrapf(err, "ProcArgs failed for pid=%v", pid)
}
if process.CommandLine != nil {
self.List = []string{*process.CommandLine}
}

self.List = []string{process.CommandLine}
return nil
}

Expand Down

0 comments on commit f498c67

Please sign in to comment.