term: use pseudo terminal in TestIsTerminalTerm on linux

Use /dev/ptmx to create a new pseudo terminal and use this in
TestIsTerminalTerm.

This should fix the test failing with ENXIO on some linux builders.

Change-Id: I39880d2cb538e3e9c8063ac79b5380ed00a476f5
Reviewed-on: https://go-review.googlesource.com/c/term/+/201417
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/term_linux_test.go b/term_linux_test.go
index 5f2443a..3931b8d 100644
--- a/term_linux_test.go
+++ b/term_linux_test.go
@@ -5,32 +5,14 @@
 package term_test
 
 import (
-	"io/ioutil"
 	"os"
-	"path/filepath"
 	"testing"
 
-	"golang.org/x/sys/unix"
 	"golang.org/x/term"
 )
 
 func TestIsTerminalTerm(t *testing.T) {
-
-	dir, err := ioutil.TempDir("", "TestIsTerminalTerm")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer os.RemoveAll(dir)
-
-	tty := filepath.Join(dir, "tty")
-	err = unix.Mknod(tty, unix.S_IFCHR, int(unix.Mkdev(5, 0)))
-	if err == unix.EPERM {
-		t.Skip("no permission to create terminal file, skipping test")
-	} else if err != nil {
-		t.Fatal(err)
-	}
-
-	file, err := os.Open(tty)
+	file, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
 	if err != nil {
 		t.Fatal(err)
 	}