Skip to content

Commit

Permalink
Merge pull request #71 from kzys/windows-signals
Browse files Browse the repository at this point in the history
Handle more signals to make ParseSignal containerd compatible
  • Loading branch information
cpuguy83 authored Jul 23, 2021
2 parents 9b0136d + 8037ded commit 8a51b5c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions signal/signal_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package signal

import (
"syscall"

"golang.org/x/sys/windows"
)

// Signals used in cli/command (no windows equivalent, use
Expand All @@ -17,10 +19,18 @@ const (
// SignalMap is a map of "supported" signals. As per the comment in GOLang's
// ztypes_windows.go: "More invented values for signals". Windows doesn't
// really support signals in any way, shape or form that Unix does.
//
// We have these so that docker kill can be used to gracefully (TERM) and
// forcibly (KILL) terminate a container on Windows.
var SignalMap = map[string]syscall.Signal{
"KILL": syscall.SIGKILL,
"TERM": syscall.SIGTERM,
"HUP": syscall.Signal(windows.SIGHUP),
"INT": syscall.Signal(windows.SIGINT),
"QUIT": syscall.Signal(windows.SIGQUIT),
"ILL": syscall.Signal(windows.SIGILL),
"TRAP": syscall.Signal(windows.SIGTRAP),
"ABRT": syscall.Signal(windows.SIGABRT),
"BUS": syscall.Signal(windows.SIGBUS),
"FPE": syscall.Signal(windows.SIGFPE),
"KILL": syscall.Signal(windows.SIGKILL),
"SEGV": syscall.Signal(windows.SIGSEGV),
"PIPE": syscall.Signal(windows.SIGPIPE),
"ALRM": syscall.Signal(windows.SIGALRM),
"TERM": syscall.Signal(windows.SIGTERM),
}

0 comments on commit 8a51b5c

Please sign in to comment.