https://github.com/bugsnag/proc-launcher
extensible program launcher
https://github.com/bugsnag/proc-launcher
bugs bugsnag debug debugging-tool error-monitoring error-reporting notifier platforms
Last synced: about 2 months ago
JSON representation
extensible program launcher
- Host: GitHub
- URL: https://github.com/bugsnag/proc-launcher
- Owner: bugsnag
- License: mit
- Created: 2020-12-23T15:24:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-06-30T15:55:22.000Z (12 months ago)
- Last Synced: 2026-02-11T01:44:47.627Z (5 months ago)
- Topics: bugs, bugsnag, debug, debugging-tool, error-monitoring, error-reporting, notifier, platforms
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 28
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Support: .github/support.md
Awesome Lists containing this project
README
# proc-launcher
An executable which launches a child process, awaiting its exit. Input/output
streams are forwarded to/from the child process, as well as system signals.
## Usage
```sh
proc-launcher [my_process] [my_process arguments]
```
## API Usage
The launcher can also be extended to handle terminated process state and output
stream contents
```go
type extension struct{}
// handle bytes added to stdout
func (ex extension) ReadStdout(bytes []byte) {
fmt.Printf("you said: %s", string(bytes))
}
// handle bytes added to stderr
func (ex extension) ReadStderr(bytes []byte) {
fmt.Printf("something bad happened: %s", string(bytes))
}
// handle child process termination
func (ex extension) AtExit(code int) {
fmt.Printf("process terminated, code %d", code)
}
func main() {
// create a new launcher using command arguments as the child process
launcher := l.New(os.Args[1:]...)
// install a custom extension. An extension can respond to any/all of the
// above interfaces.
launcher.InstallPlugin(extension{})
// launch the child process
if err := launcher.Start(); err != nil {
fmt.Printf("failed to launch process: %v", err)
}
// wait until the process terminates to exit
if err := launcher.Wait(); err != nil {
fmt.Printf("failed to await process: %v", err)
}
}
```
## Testing
```
cucumber
```