diff options
author | Christopher Rosell <chrippa@tanuki.se> | 2012-08-15 22:26:05 +0200 |
---|---|---|
committer | Christopher Rosell <chrippa@tanuki.se> | 2012-08-15 22:26:05 +0200 |
commit | 58a7c3158db64d231acf49f4324222b8ecfc47f6 (patch) | |
tree | de59dbfb6f2ff913b9c9605c255d8945e1b5dee2 /src | |
parent | fc4e35ed68fc399e1de0b27282a53f6b1bfbf962 (diff) |
Minor CLI fixes.
Diffstat (limited to 'src')
-rw-r--r-- | src/livestreamer/cli.py | 16 |
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: |