vendor/github.com/ysmood/leakless/readme.md
26 lines · 1328 bytes
1# leakless
2
3Run sub-process and make sure to kill it when the parent process exits.
4The way how it works is to output a standalone executable file to guard the subprocess and check parent TCP connection with a UUID.
5So that it works consistently on Linux, Mac, and Windows.
6
7If you don't trust the executable, you can build it yourself from the source code by running `go generate` at the root of this repo, then use the [replace](https://golang.org/ref/mod#go-mod-file-replace) to use your own module. Usually, it won't be a concern, all the executables are committed by this [Github Action](https://github.com/ysmood/leakless/actions?query=workflow%3ARelease), the Action will print the hash of the commit, you can compare it with the repo.
8
9Not using the PID is because after a process exits, a newly created process may have the same PID.
10
11## How to Use
12
13See the [examples](example_test.go).
14
15## Custom build for `GOOS` or `GOARCH`
16
17Such as if you want to support FreeBSD, you can clone this project and modify the [targets.go](cmd/pack/targets.go) to something like:
18
19```go
20var targets = []utils.Target{
21 "freebsd/amd64",
22}
23```
24
25Then run `go generate` and use [replace](https://golang.org/ref/mod#go-mod-file-replace) in the project that will use leakless.
26You can keep this fork of leakless to serve your own interest.