diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-02 04:41:26 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-02 04:41:26 +0900 |
| commit | 6931ad95c3e7d0acb45b2aafe24fb63012f061a5 (patch) | |
| tree | cfb1b22fe1cdf51c15b0519224aa4d3bb4bd66cd /internal/outcome/dispatcher.go | |
| parent | 2ba599b3997f9d4270e533ee0d0e7c235414b31a (diff) | |
internal/outcome/shim: EOF as exit request fallback
In some cases the signal might be delivered before the signal handler is installed, and synchronising against such a case is too expensive. Instead, use the pipe being closed as a fallback to the regular exit request. This change also moves installation of the signal handler early.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/outcome/dispatcher.go')
| -rw-r--r-- | internal/outcome/dispatcher.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/outcome/dispatcher.go b/internal/outcome/dispatcher.go index 77ef646a..443148c6 100644 --- a/internal/outcome/dispatcher.go +++ b/internal/outcome/dispatcher.go @@ -32,6 +32,8 @@ type syscallDispatcher interface { // just synchronising access is not enough, as this is for test instrumentation. new(f func(k syscallDispatcher, msg message.Msg)) + // getppid provides [os.Getppid]. + getppid() int // getpid provides [os.Getpid]. getpid() int // getuid provides [os.Getuid]. @@ -108,6 +110,7 @@ type direct struct{ msg message.Msg } func (k direct) new(f func(k syscallDispatcher, msg message.Msg)) { go f(k, k.msg) } +func (direct) getppid() int { return os.Getppid() } func (direct) getpid() int { return os.Getpid() } func (direct) getuid() int { return os.Getuid() } func (direct) getgid() int { return os.Getgid() } |
