aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Christopher Rosell <chrippa@tanuki.se>2012-08-15 22:26:05 +0200
committerGravatar Christopher Rosell <chrippa@tanuki.se>2012-08-15 22:26:05 +0200
commit58a7c3158db64d231acf49f4324222b8ecfc47f6 (patch)
treede59dbfb6f2ff913b9c9605c255d8945e1b5dee2 /src
parentfc4e35ed68fc399e1de0b27282a53f6b1bfbf962 (diff)
Minor CLI fixes.
Diffstat (limited to 'src')
-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: