Merge pull request #438 from trheyi/main
[add] yao run command task support
This commit is contained in:
commit
e53133d0e8
1 changed files with 11 additions and 0 deletions
11
cmd/run.go
11
cmd/run.go
|
|
@ -13,7 +13,9 @@ import (
|
||||||
"github.com/yaoapp/kun/utils"
|
"github.com/yaoapp/kun/utils"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/engine"
|
"github.com/yaoapp/yao/engine"
|
||||||
|
ischedule "github.com/yaoapp/yao/schedule"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
|
itask "github.com/yaoapp/yao/task"
|
||||||
)
|
)
|
||||||
|
|
||||||
var runSilent = false
|
var runSilent = false
|
||||||
|
|
@ -25,6 +27,7 @@ var runCmd = &cobra.Command{
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
defer share.SessionStop()
|
defer share.SessionStop()
|
||||||
defer plugin.KillAll()
|
defer plugin.KillAll()
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
err := exception.Catch(recover())
|
err := exception.Catch(recover())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -103,6 +106,14 @@ var runCmd = &cobra.Command{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start Tasks
|
||||||
|
itask.Start()
|
||||||
|
defer itask.Stop()
|
||||||
|
|
||||||
|
// Start Schedules
|
||||||
|
ischedule.Start()
|
||||||
|
defer ischedule.Stop()
|
||||||
|
|
||||||
process := process.New(name, pargs...)
|
process := process.New(name, pargs...)
|
||||||
res, err := process.Exec()
|
res, err := process.Exec()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue