From 67772abe6da6f6cfaf3798a2eb94b0a67a0e757d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Thu, 10 Feb 2022 01:46:35 +0100 Subject: [PATCH] Fix STDIN pipe detection logic --- main.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/main.py b/main.py index d120723..fd08151 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,5 @@ from sys import argv, stdin from sys import exit as sysexit -from select import select from hashlib import blake2b from io import BytesIO @@ -24,15 +23,11 @@ def get_input_stream(): io = None if len(argv) == 2: io = BytesIO(argv[1].encode()) - elif stdin_has_data(): + elif not stdin.isatty(): io = stdin.buffer return io -def stdin_has_data(): - return bool(select([stdin], [], [], 0.0)[0]) - - def print_usage_and_exit(): print('Usage: identicon [TEXT]') print('Print OpenSSH style randomart identicon for arbitrary data.\n')