INNER CODE UNIT · Go

KillProcess

kubernetes-sigs/kwok · pkg/utils/exec/cmd.go:27

func KillProcess(pid int) error {
	process, err := os.FindProcess(pid)
	if err != nil {
		return fmt.Errorf("find process %d: %w", pid, err)
	}
	err = process.Kill()
	if err != nil {
		if errors.Is(err, os.ErrProcessDone) {
			return nil
		}
		return fmt.Errorf("kill process: %w", err)
	}
	_, err = process.Wait()
	if err != nil {
		if errors.Is(err, syscall.ECHILD) {
			return nil
		}
		return err

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…