Skip to content

Commit

Permalink
fix: handle SIGTERM / SIGINT
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwitzko committed Nov 16, 2020
1 parent f0ba4a4 commit 41b1bd6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/semantic-release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"io/ioutil"
"log"
"os"
"os/signal"
"strings"
"syscall"

"github.com/Masterminds/semver/v3"
"github.com/go-semantic-release/semantic-release/v2/pkg/config"
Expand Down Expand Up @@ -75,6 +77,13 @@ func cliHandler(cmd *cobra.Command, args []string) {
pluginManager.Stop()
}

c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
exitIfError(errors.New("terminating..."))
}()

ci, err := pluginManager.GetCICondition()
exitIfError(err)
logger.Printf("ci-condition plugin: %s@%s\n", ci.Name(), ci.Version())
Expand Down

0 comments on commit 41b1bd6

Please sign in to comment.