From e82ed18a6805c525260602c8ef761e6bc3d8432b Mon Sep 17 00:00:00 2001 From: "Paul Buetow (europa)" Date: Mon, 25 May 2015 22:24:01 +0100 Subject: introduce last element --- process/process.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'process') 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} } -- cgit v1.2.3