qinglong-go/service/app.go

30 lines
623 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package service
import (
"context"
log "github.com/huoxue1/go-utils/base/log"
"github.com/huoxue1/qinglong-go/utils"
"os"
"path"
)
func AppInit() {
go runYarn()
}
func runYarn() {
defer func() {
recover()
}()
_, err := os.Stat(path.Join("data", "scripts", "package.json"))
if os.IsNotExist(err) {
return
}
ch := make(chan int, 1)
utils.RunTask(context.WithValue(context.Background(), "cancel", ch), "pnpm install", map[string]string{}, func(ctx context.Context) {
log.Infoln("开始执行pnpm初始化")
}, func(ctx context.Context) {
log.Infoln("pnpm初始化执行完成")
}, os.Stdout)
}