diff options
| author | Bryan Mills <bcmills@google.com> | 2022-04-04 14:45:45 +0000 |
|---|---|---|
| committer | Bryan Mills <bcmills@google.com> | 2022-04-04 15:12:26 +0000 |
| commit | f86f9a3038eb6db513a0ea36bc2af7a13b005e99 (patch) | |
| tree | fa4ca2cbb3d7bd12b9bb2915febdabe488c60b9f /src/os/exec_windows.go | |
| parent | 1af60b2f4990bffdd1b050ffd11e978578d1e38f (diff) | |
| download | go-f86f9a3038eb6db513a0ea36bc2af7a13b005e99.tar.xz | |
Revert "os: add handling of os.Interrupt for windows"
This reverts CL 367495.
Reason for revert: broke `x/tools` tests on Windows.
Change-Id: Iab6b33259181c9520cf8db1e5b6edfeba763f974
Reviewed-on: https://go-review.googlesource.com/c/go/+/397997
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/os/exec_windows.go')
| -rw-r--r-- | src/os/exec_windows.go | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/os/exec_windows.go b/src/os/exec_windows.go index bc232e0a00..239bed198f 100644 --- a/src/os/exec_windows.go +++ b/src/os/exec_windows.go @@ -47,14 +47,13 @@ func (p *Process) wait() (ps *ProcessState, err error) { func (p *Process) signal(sig Signal) error { handle := atomic.LoadUintptr(&p.handle) + if handle == uintptr(syscall.InvalidHandle) { + return syscall.EINVAL + } if p.done() { return ErrProcessDone } - s, ok := sig.(syscall.Signal) - if !ok { - return syscall.EWINDOWS - } - if s == syscall.SIGKILL { + if sig == Kill { var terminationHandle syscall.Handle e := syscall.DuplicateHandle(^syscall.Handle(0), syscall.Handle(handle), ^syscall.Handle(0), &terminationHandle, syscall.PROCESS_TERMINATE, false, 0) if e != nil { @@ -62,17 +61,11 @@ func (p *Process) signal(sig Signal) error { } runtime.KeepAlive(p) defer syscall.CloseHandle(terminationHandle) - e = syscall.TerminateProcess(terminationHandle, 1) + e = syscall.TerminateProcess(syscall.Handle(terminationHandle), 1) return NewSyscallError("TerminateProcess", e) } - if s == syscall.SIGINT { - e := windows.GenerateConsoleCtrlEvent(syscall.CTRL_BREAK_EVENT, uint32(p.Pid)) - if e != nil { - return NewSyscallError("GenerateConsoleCtrlEvent", e) - } - return nil - } - return syscall.EWINDOWS + // TODO(rsc): Handle Interrupt too? + return syscall.Errno(syscall.EWINDOWS) } func (p *Process) release() error { |
