clegaspi / saml_reader

A tool to parse and verify SAML response data for MongoDB Cloud.
MIT License
7 stars 2 forks source link

CLI hangs when invoked with no data in pipe #51

Closed clegaspi closed 2 years ago

clegaspi commented 3 years ago

The cli hangs when invoked as:

saml_reader

instead of one of these:

cat some_file.txt | saml_reader
saml_reader [options] < some_file.txt

This is because it is waiting for input from stdin. How long do we let it wait? Can we kill it if it doesn't have any data in it already?

clegaspi commented 3 years ago

Looks like we just need to check sys.stdin.isatty() (source) in TextReader._read_stdin() and quit if the process was not invoked with a pipe or file redirect.

If the application was started this way, we should raise an exception from that function and then catch it somewhere in the CLI to have it output the --help content.