Update vt.py

Add check for base OS running salt. BSD-like OS break at this point
This commit is contained in:
cr0hn 2015-03-28 20:09:00 +01:00 committed by rallytime
parent fe4a09d4f7
commit aafb4a98c3

View File

@ -523,13 +523,15 @@ class Terminal(object):
os.close(tty_fd) os.close(tty_fd)
# Verify we now have a controlling tty. # Verify we now have a controlling tty.
tty_fd = os.open('/dev/tty', os.O_WRONLY) if os.name != 'posix':
if tty_fd < 0: # Only do this check in not BSD-like operating systems. BSD-like operating systems breaks at this point
raise TerminalException( tty_fd = os.open('/dev/tty', os.O_WRONLY)
'Could not open controlling tty, /dev/tty' if tty_fd < 0:
) raise TerminalException(
else: 'Could not open controlling tty, /dev/tty'
os.close(tty_fd) )
else:
os.close(tty_fd)
# <---- Make STDOUT the controlling PTY ---------------------- # <---- Make STDOUT the controlling PTY ----------------------
# ----- Duplicate Descriptors -------------------------------> # ----- Duplicate Descriptors ------------------------------->