Chaostreff-Potsdam / erika3004

18 stars 5 forks source link

fix piped ASCII input #71

Closed ArchibaldBienetre closed 4 years ago

ArchibaldBienetre commented 4 years ago

This fixes https://github.com/Chaostreff-Potsdam/erika3004/issues/64

ArchibaldBienetre commented 4 years ago

One minor glitch after after the current fix: The erika will not wait for a key press once it is done rendering.

I.e., this command will wait until a key is pressed after execution:

$ ./erika.sh render_ascii_art -d -f tests/test_resources/test_ascii_art.txt 

This command will not wait, but terminate immediately:

$ cat tests/test_resources/test_ascii_art.txt | ./erika.sh render_ascii_art -d

I'll have a look at this for a brief while before Iooking for a reviewer.

EDIT: Timebox reached - I could not make it work, but added a half-second sleep for all cases instead :man_shrugging: I tried

EDIT: Maybe it's all about stdin being closed. I could imagine a workaround where I pry it open again, and feed whatever comes there to getch using https://docs.python.org/3/library/curses.html#curses.ungetch ... maybe