add tracing feature for package gproc (#1923)

This commit is contained in:
John Guo
2022-06-21 21:46:12 +08:00
committed by GitHub
parent f0568b4e22
commit 2bcee014f7
22 changed files with 355 additions and 164 deletions

View File

@ -0,0 +1,25 @@
package main
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcmd"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gproc"
)
var (
Main = &gcmd.Command{
Name: "main",
Brief: "main process",
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
g.Log().Debug(ctx, `this is main process`)
return gproc.ShellRun(ctx, `go run sub/sub.go`)
},
}
)
func main() {
Main.Run(gctx.New())
}

View File

@ -0,0 +1,24 @@
package main
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcmd"
"github.com/gogf/gf/v2/os/gctx"
)
var (
Sub = &gcmd.Command{
Name: "sub",
Brief: "sub process",
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
g.Log().Debug(ctx, `this is sub process`)
return nil
},
}
)
func main() {
Sub.Run(gctx.New())
}