Skip to content

Commit

Permalink
Merge pull request #31 from sendgrid/ignore_sigchld
Browse files Browse the repository at this point in the history
only pass in process abort/halt signals #patch
  • Loading branch information
Michael Robinson authored Sep 14, 2020
2 parents 187c775 + 06ebe06 commit 64a361f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions cmd/aws-env/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,13 @@ func invoke(r *awsenv.Replacer, prog string, args []string) error {
close(errCh)
}()
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh)
signal.Notify(sigCh, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGABRT, syscall.SIGTERM)

for {
select {
case sig := <-sigCh:
// this errror case only seems possible if the OS has released the process
// or if it isn't started. So we _should_ be able to break
// However, we might receive a "child exited" signal right before we get a
// message on the err chan, so just continue in that case
if sig == syscall.SIGCHLD {
continue
}
if err := cmd.Process.Signal(sig); err != nil {
log.WithError(err).WithField("signal", sig).Error("error sending signal")
return err
Expand Down

0 comments on commit 64a361f

Please sign in to comment.