Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
cyz-home committed Apr 10, 2022
1 parent 65bbc03 commit 096925b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions console/commands/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package commands
import (
"fmt"
"github.com/ctfang/command"
"log"
"os"
"os/exec"
)

Expand All @@ -24,16 +24,16 @@ func (DevCommand) Execute(input command.Input) {
runOtherCommand("toolset", "make:route", "-root="+root)
runOtherCommand("toolset", "make:orm", "-root="+root)
runOtherCommand("toolset", "make:bean", "-root="+root)
runOtherCommand("go", "run", root+"/main.go")
}

func runOtherCommand(name string, arg ...string) {
cmd := exec.Command(name, arg...)
out, err := cmd.CombinedOutput()
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
fmt.Printf("combined out:\n%s\n", string(out))
log.Fatalf("cmd.Run() failed with %s\n", err)
}
if len(out) > 0 {
fmt.Printf("\n%s\n", string(out))
fmt.Println("cmd.Output: ", err)
return
}
}

0 comments on commit 096925b

Please sign in to comment.