github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/pkg/system/process_windows.go (about)

     1  package system
     2  
     3  import "os"
     4  
     5  // IsProcessAlive returns true if process with a given pid is running.
     6  func IsProcessAlive(pid int) bool {
     7  	_, err := os.FindProcess(pid)
     8  
     9  	return err == nil
    10  }
    11  
    12  // KillProcess force-stops a process.
    13  func KillProcess(pid int) {
    14  	p, err := os.FindProcess(pid)
    15  	if err == nil {
    16  		p.Kill()
    17  	}
    18  }