Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.16 KB

README.md

File metadata and controls

44 lines (31 loc) · 1.16 KB

Subprocess

This go package used to Kills process and all child processes it spawned in Linux or Windows.

GoDoc Go Report Card

The main idea behind creating this package is that the Windows code part is very large and it is not practical to copy this code to every project.

Usage example

package main

import "kirill-scherba/subprocess" 

func main() {

    // Create some process, f.e. run exec.Run() function which execute buch 
    // file with subprocesses
    // 
    // var cmd *exec.Cmd
    // var err error
    // cmd, err = exec.Run("executable_name", "parameter")
    // ...
    // Use the KillProcessTree function when you want stop execution started 
    // process and all its child process.
    //

    // Kill the process and all its children
    err = subprocess.KillProcessTree(cmd.Process.Pid)
    if err != nil {
        return
    }

    // ...

}

Licence

BSD