| 1 |
-- Remove syscall.SIGKILL from list of arguments -- |
| 2 |
package main |
| 3 |
|
| 4 |
import ( |
| 5 |
"os" |
| 6 |
"os/signal" |
| 7 |
"syscall" |
| 8 |
) |
| 9 |
|
| 10 |
func fn() { |
| 11 |
c := make(chan os.Signal, 1) |
| 12 |
signal.Notify(c, os.Interrupt) |
| 13 |
signal.Ignore() //@ diag(`cannot be trapped`) |
| 14 |
signal.Ignore(os.Kill) //@ diag(`cannot be trapped`) |
| 15 |
signal.Notify(c, os.Kill) //@ diag(`cannot be trapped`) |
| 16 |
signal.Reset(os.Kill) //@ diag(`cannot be trapped`) |
| 17 |
signal.Ignore() //@ diag(`cannot be trapped`) |
| 18 |
signal.Notify(c) //@ diag(`cannot be trapped`) |
| 19 |
signal.Reset() //@ diag(`cannot be trapped`) |
| 20 |
} |
| 21 |
|
| 22 |
-- Remove os.Kill from list of arguments -- |
| 23 |
package main |
| 24 |
|
| 25 |
import ( |
| 26 |
"os" |
| 27 |
"os/signal" |
| 28 |
"syscall" |
| 29 |
) |
| 30 |
|
| 31 |
func fn() { |
| 32 |
c := make(chan os.Signal, 1) |
| 33 |
signal.Notify(c, os.Interrupt) |
| 34 |
signal.Ignore(os.Signal(syscall.SIGKILL)) //@ diag(`cannot be trapped`) |
| 35 |
signal.Ignore() //@ diag(`cannot be trapped`) |
| 36 |
signal.Notify(c) //@ diag(`cannot be trapped`) |
| 37 |
signal.Reset() //@ diag(`cannot be trapped`) |
| 38 |
signal.Ignore(syscall.SIGKILL) //@ diag(`cannot be trapped`) |
| 39 |
signal.Notify(c, syscall.SIGKILL) //@ diag(`cannot be trapped`) |
| 40 |
signal.Reset(syscall.SIGKILL) //@ diag(`cannot be trapped`) |
| 41 |
} |
| 42 |
|
| 43 |
-- Use syscall.SIGTERM instead of syscall.SIGKILL -- |
| 44 |
package main |
| 45 |
|
| 46 |
import ( |
| 47 |
"os" |
| 48 |
"os/signal" |
| 49 |
"syscall" |
| 50 |
) |
| 51 |
|
| 52 |
func fn() { |
| 53 |
c := make(chan os.Signal, 1) |
| 54 |
signal.Notify(c, os.Interrupt) |
| 55 |
signal.Ignore(syscall.SIGTERM) //@ diag(`cannot be trapped`) |
| 56 |
signal.Ignore(os.Kill) //@ diag(`cannot be trapped`) |
| 57 |
signal.Notify(c, os.Kill) //@ diag(`cannot be trapped`) |
| 58 |
signal.Reset(os.Kill) //@ diag(`cannot be trapped`) |
| 59 |
signal.Ignore(syscall.SIGTERM) //@ diag(`cannot be trapped`) |
| 60 |
signal.Notify(c, syscall.SIGTERM) //@ diag(`cannot be trapped`) |
| 61 |
signal.Reset(syscall.SIGTERM) //@ diag(`cannot be trapped`) |
| 62 |
} |
| 63 |
|
| 64 |
-- Use syscall.SIGTERM instead of os.Kill -- |
| 65 |
package main |
| 66 |
|
| 67 |
import ( |
| 68 |
"os" |
| 69 |
"os/signal" |
| 70 |
"syscall" |
| 71 |
) |
| 72 |
|
| 73 |
func fn() { |
| 74 |
c := make(chan os.Signal, 1) |
| 75 |
signal.Notify(c, os.Interrupt) |
| 76 |
signal.Ignore(os.Signal(syscall.SIGKILL)) //@ diag(`cannot be trapped`) |
| 77 |
signal.Ignore(syscall.SIGTERM) //@ diag(`cannot be trapped`) |
| 78 |
signal.Notify(c, syscall.SIGTERM) //@ diag(`cannot be trapped`) |
| 79 |
signal.Reset(syscall.SIGTERM) //@ diag(`cannot be trapped`) |
| 80 |
signal.Ignore(syscall.SIGKILL) //@ diag(`cannot be trapped`) |
| 81 |
signal.Notify(c, syscall.SIGKILL) //@ diag(`cannot be trapped`) |
| 82 |
signal.Reset(syscall.SIGKILL) //@ diag(`cannot be trapped`) |
| 83 |
} |