Source file src/cmd/go/stop_other_test.go

     1  // Copyright 2021 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 !(unix || (js && wasm))
     6  
     7  package main_test
     8  
     9  import (
    10  	"os"
    11  	"runtime"
    12  )
    13  
    14  // quitSignal returns the appropriate signal to use to request that a process
    15  // quit execution.
    16  func quitSignal() os.Signal {
    17  	if runtime.GOOS == "windows" {
    18  		// Per https://golang.org/pkg/os/#Signal, “Interrupt is not implemented on
    19  		// Windows; using it with os.Process.Signal will return an error.”
    20  		// Fall back to Kill instead.
    21  		return os.Kill
    22  	}
    23  	return os.Interrupt
    24  }
    25  

View as plain text