From 8df28fb8350c832b956ef30ce40f7610cae9d55b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionu=C8=9B=20Cioc=C3=AErlan?= Date: Tue, 21 Apr 2020 22:47:44 +0300 Subject: [PATCH] work when piped, in windows too --- assets/installer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/installer.py b/assets/installer.py index a2154877..541281b0 100755 --- a/assets/installer.py +++ b/assets/installer.py @@ -45,8 +45,9 @@ SILENT = ( not in ("", "0", "off", "false") ) -if not IS_WIN: - sys.stdin = open("/dev/tty", "r") +if not os.isatty(sys.stdin.fileno()): + # the script is being piped, we need to reset stdin + sys.stdin = open("CON:" if IS_WIN else "/dev/tty") if sys.version_info.major == 2: input = raw_input