Black Lives Matter. Support the Equal Justice Initiative.

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  // +build !windows,!plan9
     6  
     7  // This is in testprognet instead of testprog because testprog
     8  // must not import anything (like net, but also like os/signal)
     9  // that kicks off background goroutines during init.
    10  
    11  package main
    12  
    13  import (
    14  	"os/signal"
    15  	"syscall"
    16  )
    17  
    18  func init() {
    19  	register("SignalIgnoreSIGTRAP", SignalIgnoreSIGTRAP)
    20  }
    21  
    22  func SignalIgnoreSIGTRAP() {
    23  	signal.Ignore(syscall.SIGTRAP)
    24  	syscall.Kill(syscall.Getpid(), syscall.SIGTRAP)
    25  	println("OK")
    26  }
    27  

View as plain text