mirror of
https://gitee.com/johng/gf.git
synced 2024-12-03 04:37:49 +08:00
25 lines
494 B
Go
25 lines
494 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gitee.com/johng/gf/g/os/gpm"
|
|
"os"
|
|
"time"
|
|
"gitee.com/johng/gf/g/os/glog"
|
|
)
|
|
|
|
func main() {
|
|
m := gproc.New()
|
|
env := os.Environ()
|
|
env = append(env, "child=1")
|
|
p := m.NewProcess(os.Args[0], os.Args, env)
|
|
if os.Getenv("child") != "" {
|
|
time.Sleep(3*time.Second)
|
|
glog.Error("error")
|
|
} else {
|
|
pid, err := p.Run()
|
|
fmt.Println(pid)
|
|
fmt.Println(err)
|
|
fmt.Println(p.Wait())
|
|
}
|
|
} |