diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-03-25 15:34:20 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-03-25 15:39:29 +0900 |
| commit | 50403e9d60a69640107d20525379d4714da2f739 (patch) | |
| tree | eb9a72082f5aaf04c886db68b07ad8ccb9c88e72 /container/init.go | |
| parent | b98c5f2e219c142ab89c09445b6c014120f0760f (diff) | |
internal/netlink: wrap netpoll via context
This removes netpoll boilerplate for the most common use case.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/init.go')
| -rw-r--r-- | container/init.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/container/init.go b/container/init.go index 799bb29b..7a561733 100644 --- a/container/init.go +++ b/container/init.go @@ -7,6 +7,7 @@ import ( "log" "os" "os/exec" + "os/signal" "path" "slices" "strconv" @@ -175,7 +176,11 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) { } if !params.HostNet { - k.mustLoopback(msg) + ctx, cancel := signal.NotifyContext(context.Background(), CancelSignal, + os.Interrupt, SIGTERM, SIGQUIT) + defer cancel() // for panics + k.mustLoopback(ctx, msg) + cancel() } // write uid/gid map here so parent does not need to set dumpable |
