1 Star 0 Fork 0

民禧农机/tools

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run.go 520 Bytes
一键复制 编辑 原始数据 按行查看 历史
surongzhen 提交于 2020-09-10 15:52 +08:00 . init
package main
import (
"os"
"os/exec"
"path"
"path/filepath"
"github.com/urfave/cli/v2"
)
func runAction(c *cli.Context) error {
base, err := os.Getwd()
if err != nil {
panic(err)
}
dir := buildDir(base, "cmd", 5)
conf := path.Join(filepath.Dir(dir), "configs")
args := append([]string{"run", "main.go", "-conf", conf}, c.Args().Slice()...)
cmd := exec.Command("go", args...)
cmd.Dir = dir
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
panic(err)
}
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/surongzhen1213/tools.git
git@gitee.com:surongzhen1213/tools.git
surongzhen1213
tools
tools
v1.0.9

搜索帮助