diff options
| author | Paul Buetow (europa) <paul@buetow.org> | 2015-05-25 22:24:01 +0100 |
|---|---|---|
| committer | Paul Buetow (europa) <paul@buetow.org> | 2015-05-25 22:24:01 +0100 |
| commit | e82ed18a6805c525260602c8ef761e6bc3d8432b (patch) | |
| tree | 8471c872f0331f198ddbdd3641db8d418c1c2619 /process/process.go | |
| parent | 6cf925c8072bddf54e5b43de21b74be7451de67d (diff) | |
introduce last element
Diffstat (limited to 'process/process.go')
| -rw-r--r-- | process/process.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/process/process.go b/process/process.go index dade966..d33bf69 100644 --- a/process/process.go +++ b/process/process.go @@ -18,6 +18,7 @@ type Process struct { Cmdline string Count map[string]int debug string + Last bool } func new(pidstr string) (Process, error) { @@ -89,7 +90,7 @@ func (self *Process) Print() { fmt.Println(self) } -func Gather(processes chan<- Process) { +func Gather(pTxChan chan<- Process) { re, _ := regexp.Compile("^[0-9]+$") dir, err := ioutil.ReadDir("/proc/") @@ -102,8 +103,9 @@ func Gather(processes chan<- Process) { if re.MatchString(name) { p, err := new(name) if err == nil { - processes <- p + pTxChan <- p } } } + pTxChan <- Process{Last: true} } |
