aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/livestreamer/cli.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/livestreamer/cli.py b/src/livestreamer/cli.py
index 7845823..c0aa11a 100644
--- a/src/livestreamer/cli.py
+++ b/src/livestreamer/cli.py
@@ -60,14 +60,19 @@ def write_stream(fd, out, progress):
written = 0
while True:
- data = fd.read(8192)
+ try:
+ data = fd.read(8192)
+ except IOError:
+ logger.error("Error when reading from stream")
+ break
+
if len(data) == 0:
break
try:
out.write(data)
except IOError:
- logger.error("Error when reading from stream")
+ logger.error("Error when writing to output")
break
written += len(data)
@@ -161,10 +166,13 @@ def output_stream(stream, args):
try:
write_stream(fd, out, progress)
except KeyboardInterrupt:
- sys.exit()
+ pass
if player:
- player.kill()
+ try:
+ player.kill()
+ except:
+ pass
def handle_url(args):
try: