A Go package that allows you to attach to a running process and call system calls from inside the attached process.
It works on Linux and internally uses ptrace.
It was made for use in dinit to change stdout and stderr of running processes, but maybe it comes handy to somebody else as well.
This is a Go package. You can add it to your project using go get
:
go get gitlab.com/tozd/go/pcontrol
It requires Go 1.23 or newer.
See full package documentation with examples on pkg.go.dev.
There is also a read-only GitHub mirror available, if you need to fork the project there.