Commits

Miki Tebeka committed 7615cf6

New exec interface

  • Participants
  • Parent commits a3bc0a0

Comments (0)

Files changed (1)

 
 import (
 	"bufio"
+    "bytes"
 	"container/vector"
 	"exec"
 	"fmt"
 }
 
 func main() {
-	cmd, err := exec.Run("/bin/ps", []string{"ps", "-e", "-opid,ppid"},
-		os.Environ(), "", exec.DevNull, exec.Pipe, exec.MergeWithStdout)
-
+    cmd := exec.Command("/bin/ps", "-e", "-opid,ppid")
+    out, err := cmd.Output()
 	if err != nil {
 		log.Fatalf("error: can't run ps - %v\n", err)
 	}
 
-	reader := bufio.NewReader(cmd.Stdout)
+	reader := bufio.NewReader(bytes.NewBuffer(out))
 	ps := make(map[int]*vector.IntVector)
 	// Skip Header
 	_, err = reader.ReadBytes('\n')