mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 11:48:13 +01:00
Remove stream/pipe recording
It doesn't make much sense to record non-interactive commands.
This commit is contained in:
@@ -66,7 +66,6 @@ def handle_unknown_action(action):
|
||||
def record_asciicast():
|
||||
asciicast = Asciicast()
|
||||
|
||||
if sys.stdin.isatty():
|
||||
if options.command:
|
||||
command = options.command
|
||||
is_shell = False
|
||||
@@ -77,8 +76,6 @@ def record_asciicast():
|
||||
stdin_file = asciicast.stdin_file if options.record_input else None
|
||||
duration = recorders.record_process(command, is_shell,
|
||||
asciicast.stdout_file, stdin_file)
|
||||
else:
|
||||
duration = recorders.record_stream(sys.stdin, asciicast.stdout_file)
|
||||
|
||||
asciicast.user_token = config.user_token
|
||||
asciicast.command = options.command
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user