Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/sys/windows: signal.Notify doesn't handle windows.Signal well #70369

Open
QianQQQ opened this issue Nov 15, 2024 · 4 comments · May be fixed by #70368
Open

x/sys/windows: signal.Notify doesn't handle windows.Signal well #70369

QianQQQ opened this issue Nov 15, 2024 · 4 comments · May be fixed by #70368
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows Thinking
Milestone

Comments

@QianQQQ
Copy link

QianQQQ commented Nov 15, 2024

Go version

go version go1.22.3 windows/amd64

Output of go env in your module/workspace:

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\qian\AppData\Local\go-build
set GOENV=C:\Users\qian\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\qian\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\qian\go
set GOPRIVATE=
set GOROOT=D:\Environments\go
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=D:\Environments\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.3
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\qian\AppData\Local\Temp\go-build3528663502=/tmp/go-build -gno-record-gcc-switches

What did you do?

When developing a server on Windows, we want to capture the SIGINT signal for extension purposes.
https://go.dev/play/p/wiNlThXDUPT

What did you see happen?

signal.Notify(c chan<- os.Signal, sig ...os.Signal) cannot correctly capture windows.Signal.

What did you expect to see?

signal.Notify can correctly handle windows.Signal.
This means that when pressing Ctrl+C, the logic can be correctly triggered.

@gopherbot gopherbot added this to the Unreleased milestone Nov 15, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/628275 mentions this issue: os/signal: check int type of signal using reflection

@cherrymui cherrymui added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Thinking OS-Windows labels Nov 15, 2024
@cherrymui cherrymui changed the title x/sys: windows can not handle ctrl+c (SIGINT) well x/sys/windows: signal.Notify does handle windows.Signal well Nov 15, 2024
@cherrymui
Copy link
Member

cc @golang/windows

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 15, 2024
@zigo101
Copy link

zigo101 commented Nov 15, 2024

Missed "not" in title?

@seankhliao seankhliao changed the title x/sys/windows: signal.Notify does handle windows.Signal well x/sys/windows: signal.Notify doesn't handle windows.Signal well Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows Thinking
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

5 participants