fix reading from stdin

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-04-13 08:12:33 +02:00
parent d29c596fe7
commit 8d2ae0f64e
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -2327,7 +2327,7 @@ def parse_borderarg(string):
def input_images(path_expr): def input_images(path_expr):
if path_expr == "-": if path_expr == "-":
# we slurp in all data from stdin because we need to seek in it later # we slurp in all data from stdin because we need to seek in it later
result = sys.stdin.buffer.read() result = [sys.stdin.buffer.read()]
if len(result) == 0: if len(result) == 0:
raise argparse.ArgumentTypeError('"%s" is empty' % path_expr) raise argparse.ArgumentTypeError('"%s" is empty' % path_expr)
else: else:
@ -3675,7 +3675,7 @@ and left/right, respectively. It is not possible to specify asymmetric borders.
if len(args.images) == 0: if len(args.images) == 0:
logger.info("reading image from standard input") logger.info("reading image from standard input")
try: try:
args.images = [sys.stdin.buffer.read()] args.images = [[sys.stdin.buffer.read()]]
except KeyboardInterrupt: except KeyboardInterrupt:
sys.exit(0) sys.exit(0)