From 9019796ee10aef4dd8c8f47c217e1a1e85ace571 Mon Sep 17 00:00:00 2001 From: "Paul Buetow (europa)" Date: Sun, 24 May 2015 21:18:06 +0100 Subject: add Process.Print --- process/process.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'process') 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)} + } } } } -- cgit v1.2.3