mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 00:43:26 +08:00
fix: example code of startProcess (#572)
the first element of `argv` should be the command self which is 'ps' in this case, as the official doc says: "The argv slice will become os.Args in the new process, so it normally starts with the program name."
This commit is contained in:
@@ -52,7 +52,7 @@ The process id is &{2054 0}total 2056
|
||||
|
||||
```go
|
||||
// 2nd example: show all processes
|
||||
pid, err = os.StartProcess("/bin/ps", []string{"-e", "-opid,ppid,comm"}, procAttr)
|
||||
pid, err = os.StartProcess("/bin/ps", []string{"ps", "-e", "-opid,ppid,comm"}, procAttr)
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("Error %v starting process!", err) //
|
||||
|
Reference in New Issue
Block a user