You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Signals have portable numbers identifying them on various operating systems (Plan9 excluded). But it looks like there is no direct way to retrieve these numbers from the wrapped os.Signal other than a String method which lazily looks up the name of that signal and returns it or using reflection package or type assertion. That's why I'm proposing to seal a Number(): int method to os.Signal interface and adapt current implementations to it. It will be supposed to return the original receiver provided it's an integer (or a numeric type that can be converted to integer) otherwise returning -1.
In other words, these values are completely arbitrary. I don't think relying on them for something is a good idea. If you're going to have to treat signals differently on different systems anyways, then you may as well just check them against different values. For example:
Sorry, we can't expand os.Signal, as that would break the Go 1 compatibility promise. It doesn't have any unexported methods, so it's frozen: https://golang.org/pkg/os/#Signal
Signals have portable numbers identifying them on various operating systems (Plan9 excluded). But it looks like there is no direct way to retrieve these numbers from the wrapped
os.Signal
other than aString
method which lazily looks up the name of that signal and returns it or using reflection package or type assertion. That's why I'm proposing to seal aNumber(): int
method toos.Signal
interface and adapt current implementations to it. It will be supposed to return the original receiver provided it's an integer (or a numeric type that can be converted to integer) otherwise returning-1
.cf.
repo:^github.com/golang/go$ file:^src/syscall/ type Signal|Note
repo:^github.com/golang/go$ file:^src/syscall/ SIGINT count:1000
The text was updated successfully, but these errors were encountered: