Skip to content

Commit

Permalink
fix: [small] fix teardown regexp (#193)
Browse files Browse the repository at this point in the history
* fix: fix teardown regexp

* fix regexp

* delete unused file
  • Loading branch information
tk3fftk authored and catto committed Jul 10, 2018
1 parent d232c67 commit ffbd799
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package executor

import (
"bufio"
"errors"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -151,7 +150,7 @@ func initBuildTimeout(timeout time.Duration, ch chan<- error) {
log.Printf("Starting timer for timeout of %v seconds", timeout)
time.Sleep(timeout)
log.Printf("Timeout of %v seconds exceeded. Signal kill-build process", timeout)
ch <- errors.New(fmt.Sprintf("Timeout of %v seconds exceeded", timeout))
ch <- fmt.Errorf("Timeout of %v seconds exceeded", timeout)
}

// print timeout message to build & kill shell
Expand Down Expand Up @@ -189,8 +188,8 @@ func filterTeardowns(build screwdriver.Build) ([]screwdriver.CommandDef, []screw
userTeardownCommands := []screwdriver.CommandDef{}

for _, cmd := range build.Commands {
isSdTeardown, _ := regexp.MatchString("^sd-teardown-*", cmd.Name)
isUserTeardown, _ := regexp.MatchString("^teardown-*", cmd.Name)
isSdTeardown, _ := regexp.MatchString("^sd-teardown-.+", cmd.Name)
isUserTeardown, _ := regexp.MatchString("^teardown-.+", cmd.Name)

if isSdTeardown {
sdTeardownCommands = append(sdTeardownCommands, cmd)
Expand Down Expand Up @@ -294,7 +293,7 @@ func Run(path string, env []string, emitter screwdriver.Emitter, build screwdriv
}
}

teardownCommands := append(userTeardownCommands, sdTeardownCommands...);
teardownCommands := append(userTeardownCommands, sdTeardownCommands...)

for index, cmd := range teardownCommands {
if index == 0 && firstError == nil {
Expand Down

0 comments on commit ffbd799

Please sign in to comment.