Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2012 The Go Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style | |
3 // license that can be found in the LICENSE file. | |
4 | |
5 package main | |
6 | |
7 import ( | |
8 "fmt" | |
9 "os" | |
10 "os/signal" | |
11 "sync" | |
12 ) | |
13 | |
14 // ignoreSignals setup for some signals to be ignored. | |
15 func ignoreSignals() { | |
16 sig := make(chan os.Signal) | |
17 signal.Notify(sig, signalsToIgnore...) | |
18 go func() { | |
19 for s := range sig { | |
20 fmt.Fprintf(os.Stderr, "\n%s: %s received, ignoring\n", os.Args[0], s) | |
rsc
2012/12/10 06:41:16
I don't think anything needs to be printed.
On Un
brainman
2012/12/11 06:25:42
^C goes to "process group", and go process ignores
| |
21 } | |
22 }() | |
23 } | |
24 | |
25 var onceIgnoreSignals sync.Once | |
26 | |
27 // startSigHandlers start signal handlers. | |
28 func startSigHandlers() { | |
29 onceIgnoreSignals.Do(ignoreSignals) | |
30 } | |
OLD | NEW |