Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tg123/jobobject
Windows JobObject utils for kill all child processes when parent process exits
https://github.com/tg123/jobobject
golang jobobject
Last synced: about 2 months ago
JSON representation
Windows JobObject utils for kill all child processes when parent process exits
- Host: GitHub
- URL: https://github.com/tg123/jobobject
- Owner: tg123
- License: mit
- Created: 2021-06-14T12:19:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-07T18:25:10.000Z (over 1 year ago)
- Last Synced: 2024-10-16T15:43:26.489Z (3 months ago)
- Topics: golang, jobobject
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JobObject
[![](https://pkg.go.dev/badge/github.com/tg123/jobobject?status.svg)](https://pkg.go.dev/github.com/tg123/jobobject)
Windows JobObject utils for kill all child processes when parent process exits
# Exmaple```
func main() {
e := exec.Command("notepad.exe")
e.Start()job, err := jobobject.Create()
if err != nil {
panic(err)
}err = job.AddProcess(e.Process)
if err != nil {
panic(err)
}// defer job.Close() // This jobobj will be closed even if the parent process is killed
fmt.Println("ctrl + c to quit and kill notepad.exe")
time.Sleep(time.Hour * 1)
}
```