Skip to content

Commit

Permalink
Merge pull request #3 from jspricke/lint_stdin
Browse files Browse the repository at this point in the history
Don't overwrite '-' in infile_path
  • Loading branch information
vancraar authored Nov 25, 2024
2 parents a1d010a + 25e07f9 commit 57c20b3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmakelang/lint/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 57c20b3

Please sign in to comment.