Skip to content

Commit b5ecf76

Browse files
authored
Merge pull request #378 from JoelLinn/fix-sighup-crash
Fix exit(2) on SIGHUP before fully initialized.
2 parents 02edf71 + da43720 commit b5ecf76

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/docker-gen/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import (
55
"fmt"
66
"log"
77
"os"
8+
"os/signal"
89
"path/filepath"
10+
"syscall"
911

1012
"github.com/BurntSushi/toml"
1113
docker "github.com/fsouza/go-dockerclient"
@@ -113,6 +115,10 @@ func initFlags() {
113115
}
114116

115117
func main() {
118+
// SIGHUP is used to trigger generation but go programs call os.Exit(2) at default.
119+
// Ignore the signal until the handler is registered:
120+
signal.Ignore(syscall.SIGHUP)
121+
116122
initFlags()
117123

118124
if version {

0 commit comments

Comments
 (0)