github.com/searKing/golang/go@v1.2.117/os/exec/kill_linux.go (about)

     1  // Copyright 2020 The searKing Author. 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 exec
     6  
     7  import "os/exec"
     8  
     9  func KillProcByName(pname string) {
    10  	params := []string{
    11  		"killall",
    12  		"-9",
    13  		pname,
    14  	}
    15  	exec.Command(params[0], params[1:]...).CombinedOutput()
    16  }