improve command gf run

This commit is contained in:
John Guo 2022-04-07 22:07:47 +08:00
parent 1e141d9f64
commit 119d8bf98c
2 changed files with 4 additions and 4 deletions

View File

@ -13,6 +13,7 @@ import (
"github.com/gogf/gf/v2/os/gproc"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/os/gtimer"
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gtag"
)
@ -149,9 +150,9 @@ func (app *cRunApp) Run() {
if runtime.GOOS == "windows" {
// Special handling for windows platform.
// DO NOT USE "cmd /c" command.
process = gproc.NewProcess(runCommand, nil)
process = gproc.NewProcess(outputPath, gstr.SplitAndTrim(" ", app.Args))
} else {
process = gproc.NewProcessCmd(runCommand, nil)
process = gproc.NewProcessCmd(outputPath, gstr.SplitAndTrim(" ", app.Args))
}
if pid, err := process.Start(); err != nil {
mlog.Printf("build running error: %s", err.Error())

View File

@ -38,8 +38,7 @@ func getRegexp(pattern string) (regex *regexp.Regexp, err error) {
}
// If it does not exist in the cache,
// it compiles the pattern and creates one.
regex, err = regexp.Compile(pattern)
if err != nil {
if regex, err = regexp.Compile(pattern); err != nil {
err = gerror.Wrapf(err, `regexp.Compile failed for pattern "%s"`, pattern)
return
}