Пример #1
0
def isInteractivePosix():
    try:
        import posix
        tty = open("/dev/tty")
        tpgrp = posix.tcgetpgrp(tty.fileno())
        pgrp = posix.getpgrp()
        tty.close()
        return (tpgrp == pgrp)
    finally:
        return False
Пример #2
0
def isInteractivePosix():
    try:
        import posix
        tty = open("/dev/tty")
        tpgrp = posix.tcgetpgrp(tty.fileno())
        pgrp = posix.getpgrp()
        tty.close()
        return (tpgrp == pgrp)
    finally:
        return False
Пример #3
0
def is_interactive():
    '''Return true if run from an interactive session.'''
    try:
        tty = open('/dev/tty')

        tpgrp = posix.tcgetpgrp(tty.fileno())
        pgrp  = posix.getpgrp()

        tty.close()

        return (tpgrp == pgrp)

    except IOError:
        return False
Пример #4
0
 def is_foreground():
   tpgrp = posix.tcgetpgrp(posix_tty_fd)
   pgrp  = posix.getpgrp()
   return tpgrp == pgrp