os/signal: SIGINT cannot be catched with cgo system("ls") call #26245
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
OS-Darwin
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes with
go version go1.10.3 darwin/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/wujeff/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/s8/rvfmqfnd28qb86358xcy1zbr00_t7y/T/go-build817291637=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
package main
import (
"fmt"
"os"
"os/signal"
)
/*
#include <stdlib.h>
static inline void RunCmd() {
system("pwd");
}
*/
import "C"
func main() {
fmt.Println("let's test...")
wait := make(chan bool)
C.RunCmd()
fmt.Println("run command finished")
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
for sig := range c {
fmt.Println(sig.String())
os.Exit(0)
}
}()
select {
case <-wait:
os.Exit(0)
}
}
build the go file then press command+c in Mac to interrupt
What did you expect to see?
process exit successfully
What did you see instead?
lots of error messages:
fatal: morestack on g0
fatal: morestack on g0
fatal: morestack on g0
The text was updated successfully, but these errors were encountered: