summaryrefslogtreecommitdiff
path: root/process
diff options
context:
space:
mode:
authorPaul Buetow (europa) <paul@buetow.org>2015-05-24 21:18:06 +0100
committerPaul Buetow (europa) <paul@buetow.org>2015-05-24 21:18:06 +0100
commit9019796ee10aef4dd8c8f47c217e1a1e85ace571 (patch)
tree8ce6dc6d3096b6fb1462c3bdb8a1551d950e2431 /process
parent8ff768026dfa04d2e1a2c9c9f4cd8b08642004fa (diff)
add Process.Print
Diffstat (limited to 'process')
-rw-r--r--process/process.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/process/process.go b/process/process.go
index 4420b44..9004349 100644
--- a/process/process.go
+++ b/process/process.go
@@ -13,6 +13,12 @@ type Process struct {
Cmdline string
}
+func (self *Process) Print() {
+ fmt.Printf("=====================\n")
+ fmt.Printf("PID: %d\n", self.Pid)
+ fmt.Printf("cmdline: %s\n", self.Cmdline)
+}
+
func Gather(res chan<- Process) {
re, _ := regexp.Compile("^[0-9]+$")
@@ -29,7 +35,9 @@ func Gather(res chan<- Process) {
if err != nil {
log.Fatal(err)
}
- res <- Process{Pid: pid, Cmdline: string(bytes)}
+ if len(bytes) > 0 {
+ res <- Process{Pid: pid, Cmdline: string(bytes)}
+ }
}
}
}