Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
flags = fcntl.fcntl(pipe_w, fcntl.F_SETFL, flags)
signal.set_wakeup_fd(pipe_w)
old_handlers = _signals(map(lambda s: (s, lambda signal, frame: None),
[signal.SIGWINCH,
signal.SIGCHLD,
signal.SIGHUP,
signal.SIGTERM,
signal.SIGQUIT]))
_set_pty_size()
start_time = time.time() - time_offset
with raw(pty.STDIN_FILENO):
try:
_copy(pipe_r)
except (IOError, OSError):
pass
_signals(old_handlers)
os.waitpid(pid, 0)
def play(self, asciicast, idle_time_limit=None, speed=1.0):
try:
stdin = open('/dev/tty')
with raw(stdin.fileno()):
self._play(asciicast, idle_time_limit, speed, stdin)
except Exception:
self._play(asciicast, idle_time_limit, speed, None)
def play(self, asciicast, max_wait=None, speed=1.0):
if os.isatty(sys.stdin.fileno()):
with raw(sys.stdin.fileno()):
self._play(asciicast, max_wait, speed, True)
else:
self._play(asciicast, max_wait, speed, False)
flags = fcntl.fcntl(pipe_w, fcntl.F_GETFL, 0)
flags = flags | os.O_NONBLOCK
flags = fcntl.fcntl(pipe_w, fcntl.F_SETFL, flags)
signal.set_wakeup_fd(pipe_w)
old_handlers = _signals(map(lambda s: (s, lambda signal, frame: None),
[signal.SIGWINCH,
signal.SIGCHLD,
signal.SIGHUP,
signal.SIGTERM,
signal.SIGQUIT]))
_set_pty_size()
with raw(pty.STDIN_FILENO):
try:
_copy(pipe_r)
except (IOError, OSError):
pass
_signals(old_handlers)
os.waitpid(pid, 0)
output.close()