mirror of
https://github.com/octoleo/restic.git
synced 2024-12-29 05:13:09 +00:00
f80b07b2c8
The previous implementation assumed that stdin was a terminal. It now checks the terminal's fd.
20 lines
318 B
Go
20 lines
318 B
Go
package termstatus
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
rtest "github.com/restic/restic/internal/test"
|
|
)
|
|
|
|
func TestIsProcessBackground(t *testing.T) {
|
|
tty, err := os.Open("/dev/tty")
|
|
if err != nil {
|
|
t.Skipf("can't open terminal: %v", err)
|
|
}
|
|
defer tty.Close()
|
|
|
|
_, err = isProcessBackground(tty.Fd())
|
|
rtest.OK(t, err)
|
|
}
|