...

Source file src/runtime/testdata/testprognet/signal.go

Documentation: runtime/testdata/testprognet

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !windows && !plan9
     6  // +build !windows,!plan9
     7  
     8  // This is in testprognet instead of testprog because testprog
     9  // must not import anything (like net, but also like os/signal)
    10  // that kicks off background goroutines during init.
    11  
    12  package main
    13  
    14  import (
    15  	"os/signal"
    16  	"syscall"
    17  )
    18  
    19  func init() {
    20  	register("SignalIgnoreSIGTRAP", SignalIgnoreSIGTRAP)
    21  }
    22  
    23  func SignalIgnoreSIGTRAP() {
    24  	signal.Ignore(syscall.SIGTRAP)
    25  	syscall.Kill(syscall.Getpid(), syscall.SIGTRAP)
    26  	println("OK")
    27  }
    28  

View as plain text