Skip to content

Commit

Permalink
check process queue when catching error
Browse files Browse the repository at this point in the history
  • Loading branch information
MinatoHikari committed May 11, 2022
1 parent 6f88811 commit 4c79620
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Loop:
for scanner.Scan() {
m := scanner.Text()
fmt.Println(m)
if strings.Contains(m, "DONE") {
if strings.Contains(m, "exit status") {
if err := c.Process.Release(); err != nil {
panic(err)
}
Expand Down Expand Up @@ -80,7 +80,7 @@ func RunBuild(logger *golog.Logger, script string) error {

str = script
if script == "" {
str = "build:dev"
str = "build"
}

npmRunBuild := exec.Command("npm", "run", str)
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func GetToken() *string {
return &token
}

// GetPort 获取服务运行的端口
func GetPort() string {
port := Config.GetString("port")
if port != "" {
Expand Down
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ func RunDeployProcess(logger *golog.Logger, path string, script string, dist str

<-Queue

Checkqueue(logger, path, script, dist)

return
}

Expand All @@ -131,6 +133,8 @@ func RunDeployProcess(logger *golog.Logger, path string, script string, dist str

<-Queue

Checkqueue(logger, path, script, dist)

return
}

Expand All @@ -141,6 +145,8 @@ func RunDeployProcess(logger *golog.Logger, path string, script string, dist str

<-Queue

Checkqueue(logger, path, script, dist)

return
}

Expand All @@ -151,13 +157,20 @@ func RunDeployProcess(logger *golog.Logger, path string, script string, dist str

<-Queue

Checkqueue(logger, path, script, dist)

return
}

logger.Info("successfully deployed")

<-Queue

Checkqueue(logger, path, script, dist)
}

// Checkqueue check if there are other processes exist
func Checkqueue(logger *golog.Logger, path string, script string, dist string) {
if len(Processes) != 0 {
Queue <- 1

Expand Down

0 comments on commit 4c79620

Please sign in to comment.