Source file src/runtime/testdata/testprog/signal_pid1.go

     1  // Copyright 2026 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  package main
     6  
     7  import (
     8  	"fmt"
     9  	"os"
    10  	"time"
    11  )
    12  
    13  func init() {
    14  	register("SignalPid1", SignalPid1)
    15  }
    16  
    17  // SignalPid1 is a helper for TestSignalPid1.
    18  func SignalPid1() {
    19  	if os.Getpid() != 1 {
    20  		fmt.Fprintln(os.Stderr, "I am not PID 1")
    21  		return
    22  	}
    23  	fmt.Println("ready")
    24  
    25  	time.Sleep(time.Hour)
    26  }
    27  

View as plain text