From 25e07f99ea725e615b113835745e92c5a1551e5d Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Sat, 18 Dec 2021 17:21:19 +0100 Subject: [PATCH] Don't overwrite '-' in infile_path Needed to lint stdin. --- cmakelang/lint/__main__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmakelang/lint/__main__.py b/cmakelang/lint/__main__.py index a172290..d1a9038 100644 --- a/cmakelang/lint/__main__.py +++ b/cmakelang/lint/__main__.py @@ -144,12 +144,13 @@ def inner_main(): config_dict.update(argdict) cfg = configuration.Configuration(**config_dict) + file_path = infile_path if infile_path == '-': - infile_path = os.dup(sys.stdin.fileno()) + file_path = os.dup(sys.stdin.fileno()) try: infile = io.open( - infile_path, mode='r', encoding=cfg.encode.input_encoding, newline='') + file_path, mode='r', encoding=cfg.encode.input_encoding, newline='') except (IOError, OSError): logger.error("Failed to open %s for read", infile_path) returncode = 1