From 58a7c3158db64d231acf49f4324222b8ecfc47f6 Mon Sep 17 00:00:00 2001 From: Christopher Rosell Date: Wed, 15 Aug 2012 22:26:05 +0200 Subject: Minor CLI fixes. --- src/livestreamer/cli.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') 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: -- cgit v1.2.3