Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Reaper

"reaper" utilizes the reap package to build an executable intermediary process runner. This runner is meant to be executed by other Go programs, in order to create detached processes for them.

Installation

Run go get github.com/foresthoffman/reaper

In order for the reaper executable to work, you must have $GOPATH/bin in your $PATH environment variable.

Importing

This package is not a library. It provides an executable that can be used by other programs, therefore importing it doesn't do anything.

Usage

Here's a simple example of the syntax:

package main
import (
"bytes""fmt""os/exec""strconv"
)
funcmain() {
// prepare a buffer, to which the PID will be writtenvarstdout bytes.Buffer// prepare the commandsleepCmd:=exec.Command("reaper", "-cmd='sleep'", "-args='30'")
sleepCmd.Stdout=&stdout// run the commanderr:=sleepCmd.Run()
ifnil!=err {
panic(err)
}
// convert the PID string to a valid integerpidInt, err:=strconv.ParseInt(stdout.String(), 10, 64)
ifnil!=err {
panic(err)
}
pid:=int(pidInt)
fmt.Printf("Created a detached process with an ID of %d!\n", pid)
}

That's all, enjoy!

About

A Go package that builds an executable intermediary process runner.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages