scripts: Fixed openio issue where some scripts didn't import os

This only failed if "-" was used as an argument (for stdin/stdout), so
the issue was pretty hard to spot.

openio is a heavily copy-pasted function, so it makes sense to just add
the import os to openio directly. Otherwise this mistake will likely
happen again in the future.
This commit is contained in:
Christopher Haster
2025-03-11 15:27:09 -05:00
parent b2646148c1
commit 313696ecf9
25 changed files with 25 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ CTX_PATH = ['./scripts/ctx.py']
def openio(path, mode='r', buffering=-1):
# allow '-' for stdin/stdout
import os
if path == '-':
if 'r' in mode:
return os.fdopen(os.dup(sys.stdin.fileno()), mode, buffering)