Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

Commit

Permalink
Merge pull request #25 from daddykotex/master
Browse files Browse the repository at this point in the history
Ensure that interrupt signals are not relayed to the interrupt channel when the migration is over
  • Loading branch information
mattes committed Jan 23, 2017
2 parents 0861ff9 + 820c58b commit 0b3426b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pipe/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pipe

import (
"os"
"os/signal"
)

// New creates a new pipe. A pipe is basically a channel.
Expand All @@ -25,6 +26,7 @@ func Close(pipe chan interface{}, err error) {
func WaitAndRedirect(pipe, redirectPipe chan interface{}, interrupt chan os.Signal) (ok bool) {
errorReceived := false
interruptsReceived := 0
defer stopNotifyInterruptChannel(interrupt)
if pipe != nil && redirectPipe != nil {
for {
select {
Expand Down Expand Up @@ -75,3 +77,9 @@ func ReadErrors(pipe chan interface{}) []error {
}
return err
}

func stopNotifyInterruptChannel(interruptChannel chan os.Signal) {
if interruptChannel != nil {
signal.Stop(interruptChannel)
}
}

0 comments on commit 0b3426b

Please sign in to comment.