mirror of https://github.com/python/cpython.git
Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
This commit is contained in:
parent
e7eaec699e
commit
39d795d8c1
|
@ -7,9 +7,17 @@
|
|||
|
||||
try:
|
||||
tty = open("/dev/tty", "r")
|
||||
tty.close()
|
||||
except IOError:
|
||||
raise unittest.SkipTest("Unable to open /dev/tty")
|
||||
else:
|
||||
# Skip if another process is in foreground
|
||||
r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ")
|
||||
tty.close()
|
||||
rpgrp = struct.unpack("i", r)[0]
|
||||
if rpgrp not in (os.getpgrp(), os.getsid(0)):
|
||||
raise unittest.SkipTest("Neither the process group nor the session "
|
||||
"are attached to /dev/tty")
|
||||
del tty, r, rpgrp
|
||||
|
||||
try:
|
||||
import pty
|
||||
|
|
Loading…
Reference in New Issue