fixed problem with piping

This commit is contained in:
ickyicky 2021-07-11 01:22:46 +02:00
parent 77e856a177
commit 7cf3df20e1
2 changed files with 5 additions and 6 deletions

View file

@ -21,8 +21,4 @@ Program also allows user to pipe text into it. Keep in mind, it only supports sp
# Known issues
_Fasttyper_ relies on curses library, so in order to allow it to first read piped text and then read characters from terminal users have to exec:
`exec 3<&0`
in their terminal before piping text to _Fasttyper_, duplicating stdin to descriptor 3.
Too large text brakes the app.

View file

@ -59,7 +59,10 @@ def main():
rbuffer = io.StringIO(f.read())
else:
input_lines = sys.stdin.readlines()
os.dup2(3, 0)
with open("/dev/tty") as f:
os.dup2(f.fileno(), 0)
rbuffer = io.StringIO("".join(input_lines))
try: