summaryrefslogtreecommitdiff
path: root/process
diff options
context:
space:
mode:
authorPaul Buetow (europa) <paul@buetow.org>2015-05-25 22:24:01 +0100
committerPaul Buetow (europa) <paul@buetow.org>2015-05-25 22:24:01 +0100
commite82ed18a6805c525260602c8ef761e6bc3d8432b (patch)
tree8471c872f0331f198ddbdd3641db8d418c1c2619 /process
parent6cf925c8072bddf54e5b43de21b74be7451de67d (diff)
introduce last element
Diffstat (limited to 'process')
-rw-r--r--process/process.go6
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}
}