-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make signal handling portable (#122)
Plan9port and Plan 9 acme handles these signal: ``` char *oknotes[] ={ "delete", "hangup", // SIGHUP "kill", // SIGTERM "exit", nil }; ``` I'm not sure what generates the "delete" and "exit" signals, but SIGTERM was missing from Edwood's list, so I've added that. SIGQUIT is useful for debugging a Go program (typing ctrl-\ will print stack trace of all running goroutines), so I removed that. SIGSTOP cannot be handled, so that was also removed. Edwood was ignoring all other signals, which seems wrong. I made it so it'll only ignore what plan9port acme was ignoring: ``` char *ignotes[] = { "sys: write on closed pipe", // SIGPIPE "sys: ttin", // SIGTTIN "sys: ttou", // SIGTTOU "sys: tstp", // SIGTSTP nil }; ``` Helps #115 Helps #116
- Loading branch information
Showing
5 changed files
with
66 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// +build plan9 | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
var ignoreSignals = []os.Signal{ | ||
syscall.Note("sys: write on closed pipe"), | ||
} | ||
|
||
var hangupSignals = []os.Signal{ | ||
syscall.SIGINT, | ||
syscall.SIGTERM, | ||
syscall.SIGHUP, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
var ignoreSignals = []os.Signal{ | ||
syscall.SIGPIPE, | ||
syscall.SIGTTIN, | ||
syscall.SIGTTOU, | ||
syscall.SIGTSTP, | ||
} | ||
|
||
var hangupSignals = []os.Signal{ | ||
syscall.SIGINT, | ||
syscall.SIGTERM, | ||
syscall.SIGHUP, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// +build windows | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
var ignoreSignals = []os.Signal{ | ||
syscall.SIGPIPE, | ||
} | ||
|
||
var hangupSignals = []os.Signal{ | ||
syscall.SIGINT, | ||
syscall.SIGTERM, | ||
syscall.SIGHUP, | ||
} |