processinfo
This commit is contained in:
parent
f2a517dfd7
commit
09f63cea0b
8
main.go
8
main.go
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/mitchellh/cli"
|
||||
"github.com/mitchellh/panicwrap"
|
||||
"github.com/mitchellh/prefixedio"
|
||||
"github.com/shirou/gopsutil/process"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -192,7 +193,12 @@ func wrappedMain() int {
|
|||
}
|
||||
ui = basicUi
|
||||
if !inPlugin {
|
||||
if TTY, err := openTTY(); err != nil {
|
||||
currentPID := os.Getpid()
|
||||
myProc, _ := process.NewProcess(int32(currentPID))
|
||||
bg, _ := myProc.Background()
|
||||
if bg {
|
||||
fmt.Fprint(os.Stderr, "Running in background, not using a TTY\n")
|
||||
} else if TTY, err := openTTY(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "No tty available: %s\n", err)
|
||||
} else {
|
||||
basicUi.TTY = TTY
|
||||
|
|
Loading…
Reference in New Issue