mirror of
https://github.com/beego/bee.git
synced 2024-11-22 10:10:53 +00:00
Merge pull request #537 from wilhelmguo/master
Support extra args to run application.
This commit is contained in:
commit
a386880832
@ -58,6 +58,8 @@ var (
|
|||||||
currentGoPath string
|
currentGoPath string
|
||||||
// Current runmode
|
// Current runmode
|
||||||
runmode string
|
runmode string
|
||||||
|
// Extra args to run application
|
||||||
|
runargs string
|
||||||
// Extra directories
|
// Extra directories
|
||||||
extraPackages utils.StrFlags
|
extraPackages utils.StrFlags
|
||||||
)
|
)
|
||||||
@ -71,6 +73,7 @@ func init() {
|
|||||||
CmdRun.Flag.BoolVar(&vendorWatch, "vendor", false, "Enable watch vendor folder.")
|
CmdRun.Flag.BoolVar(&vendorWatch, "vendor", false, "Enable watch vendor folder.")
|
||||||
CmdRun.Flag.StringVar(&buildTags, "tags", "", "Set the build tags. See: https://golang.org/pkg/go/build/")
|
CmdRun.Flag.StringVar(&buildTags, "tags", "", "Set the build tags. See: https://golang.org/pkg/go/build/")
|
||||||
CmdRun.Flag.StringVar(&runmode, "runmode", "", "Set the Beego run mode.")
|
CmdRun.Flag.StringVar(&runmode, "runmode", "", "Set the Beego run mode.")
|
||||||
|
CmdRun.Flag.StringVar(&runargs, "runargs", "", "Extra args to run application")
|
||||||
CmdRun.Flag.Var(&extraPackages, "ex", "List of extra package to watch.")
|
CmdRun.Flag.Var(&extraPackages, "ex", "List of extra package to watch.")
|
||||||
exit = make(chan bool)
|
exit = make(chan bool)
|
||||||
commands.AvailableCommands = append(commands.AvailableCommands, CmdRun)
|
commands.AvailableCommands = append(commands.AvailableCommands, CmdRun)
|
||||||
|
@ -206,7 +206,13 @@ func Start(appname string) {
|
|||||||
cmd = exec.Command(appname)
|
cmd = exec.Command(appname)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
if runargs != "" {
|
||||||
|
r := regexp.MustCompile("'.+'|\".+\"|\\S+")
|
||||||
|
m := r.FindAllString(runargs, -1)
|
||||||
|
cmd.Args = append([]string{appname}, m...)
|
||||||
|
} else {
|
||||||
cmd.Args = append([]string{appname}, config.Conf.CmdArgs...)
|
cmd.Args = append([]string{appname}, config.Conf.CmdArgs...)
|
||||||
|
}
|
||||||
cmd.Env = append(os.Environ(), config.Conf.Envs...)
|
cmd.Env = append(os.Environ(), config.Conf.Envs...)
|
||||||
|
|
||||||
go cmd.Run()
|
go cmd.Run()
|
||||||
|
Loading…
Reference in New Issue
Block a user