Remove stream/pipe recording

It doesn't make much sense to record non-interactive commands.
This commit is contained in:
Marcin Kulik
2013-09-25 21:54:17 +02:00
parent 48c108a7b1
commit 0e0ec89432
2 changed files with 9 additions and 34 deletions

View File

@@ -66,19 +66,16 @@ def handle_unknown_action(action):
def record_asciicast():
asciicast = Asciicast()
if sys.stdin.isatty():
if options.command:
command = options.command
is_shell = False
else:
command = os.environ['SHELL']
is_shell = True
stdin_file = asciicast.stdin_file if options.record_input else None
duration = recorders.record_process(command, is_shell,
asciicast.stdout_file, stdin_file)
if options.command:
command = options.command
is_shell = False
else:
duration = recorders.record_stream(sys.stdin, asciicast.stdout_file)
command = os.environ['SHELL']
is_shell = True
stdin_file = asciicast.stdin_file if options.record_input else None
duration = recorders.record_process(command, is_shell,
asciicast.stdout_file, stdin_file)
asciicast.user_token = config.user_token
asciicast.command = options.command

View File

@@ -12,11 +12,6 @@ import time
import tty
def record_stream(stream, stdout_file):
recorder = StreamRecorder(stream, stdout_file)
return record(recorder)
def record_process(command, is_shell, stdout_file, stdin_file=None):
recorder = ProcessRecorder(command, is_shell, stdout_file, stdin_file)
return record(recorder)
@@ -29,23 +24,6 @@ def record(recorder):
return end_time - start_time
class StreamRecorder(object):
def __init__(self, stream, stdout_file):
self.stream = stream
self.stdout_file = stdout_file
def run(self):
while 1:
line = self.stream.readline()
if len(line) == 0:
break
self.stdout_file.write(line)
print line,
class ProcessRecorder(object):
'''Pseudo-terminal recorder.