Standard library / os
os.Process.Release()
Releases the process handle without waiting for exit; not a substitute for reaping a child on Unix. Here release a handle to this process rather than abandon a child. Example intended for Linux/AMD64 with Go 1.23.2 in a disposable working directory; other platforms may differ. Expected stdout: 'released\n'.
Formal Syntax & Structure
go syntaxgo
func (p *Process) Release() errorReturn Value
error
Releases the process handle without waiting for exit; not a substitute for reaping a child on Unix.
Working Example
Example Snippetgo
package main
import ( "fmt" "os")
func must(e error) { if e != nil { panic(e) }}func main() { p, e := os.FindProcess(os.Getpid()); must(e); must(p.Release()); fmt.Println("released") }