Created
November 30, 2014 17:09
-
-
Save ernestas-poskus/31fe6e42a34795b6d6bd to your computer and use it in GitHub Desktop.
PID of running process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
) | |
func main() { | |
os.Create("a.txt") | |
argv := []string{"-f", "a.txt"} | |
files := []*os.File{nil, os.Stdout, os.Stderr} | |
attr := &os.ProcAttr{Dir: "./", Files: files} | |
pro, _ := os.StartProcess("/usr/bin/tail", argv, attr) | |
fmt.Println(pro.Pid) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment