build differently for openbsd because we can't cross compile the process library

This commit is contained in:
Megan Marsh 2019-09-18 10:51:46 -07:00
parent 11c87a786a
commit e59c122dff
1 changed files with 6 additions and 4 deletions

10
main.go
View File

@ -25,7 +25,6 @@ import (
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
"github.com/mitchellh/panicwrap" "github.com/mitchellh/panicwrap"
"github.com/mitchellh/prefixedio" "github.com/mitchellh/prefixedio"
"github.com/shirou/gopsutil/process"
) )
func main() { func main() {
@ -194,9 +193,12 @@ func wrappedMain() int {
ui = basicUi ui = basicUi
if !inPlugin { if !inPlugin {
currentPID := os.Getpid() currentPID := os.Getpid()
myProc, _ := process.NewProcess(int32(currentPID)) backgrounded, err := checkProcess(currentPID)
bg, _ := myProc.Background() if err != nil {
if bg { fmt.Fprintf(os.Stderr, "cannot determind if process is in "+
"background: %s\n", err)
}
if backgrounded {
fmt.Fprint(os.Stderr, "Running in background, not using a TTY\n") fmt.Fprint(os.Stderr, "Running in background, not using a TTY\n")
} else if TTY, err := openTTY(); err != nil { } else if TTY, err := openTTY(); err != nil {
fmt.Fprintf(os.Stderr, "No tty available: %s\n", err) fmt.Fprintf(os.Stderr, "No tty available: %s\n", err)