aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Christopher Rosell <chrippa@tanuki.se>2012-06-22 00:07:06 +0200
committerGravatar Christopher Rosell <chrippa@tanuki.se>2012-06-22 00:07:06 +0200
commitac006c29ea56af11b1fdb9ef57882220affc687e (patch)
treed71d05884be2f3c0fd3b2c141d67c72bc7f9d71a
parentaf8ca6d10cad5b9f0519345f85d7d2778e00122b (diff)
Always make sure output is in binary mode on Windows.
-rw-r--r--src/livestreamer/cli.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/livestreamer/cli.py b/src/livestreamer/cli.py
index 429c43d..5ce15c5 100644
--- a/src/livestreamer/cli.py
+++ b/src/livestreamer/cli.py
@@ -2,7 +2,7 @@
import sys, os, argparse, subprocess
import livestreamer
-from livestreamer.compat import input, stdout
+from livestreamer.compat import input, stdout, is_win32
exampleusage = """
example usage:
@@ -130,6 +130,10 @@ def output_stream(stream, args):
if not out:
exit("Failed to open a valid stream output")
+ if is_win32:
+ import msvcrt
+ msvcrt.setmode(out.fileno(), os.O_BINARY)
+
try:
write_stream(fd, out, progress)
except KeyboardInterrupt: