mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-18 23:07:07 -05:00
fix(stubgen): reconfigure stdout only when it supports it
Callers that replace sys.stdout (test_stubgen redirect_stdout) have no reconfigure(). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
f6d5404f45
commit
ff6c1ea5f3
1 file changed
+2
-1
+2
-1
@@ -211,7 +211,8 @@ def main(argv=None):
|
||||
ap.add_argument("--td-out", required=False, default=None, help="output file for TechnicalDebt lines, which go in docs/dev/debt/MODULE.md, default stderr when code uses stdout, otherwise stdout")
|
||||
ap.add_argument("--td-only", action="store_true", help="print only TechnicalDebt lines, no code")
|
||||
args = ap.parse_args(argv)
|
||||
sys.stdout.reconfigure(encoding="utf-8", newline="\n")
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", newline="\n")
|
||||
try:
|
||||
if not args.td_only and args.out and args.td_out and same_file(args.out, args.td_out):
|
||||
ap.error("--out and --td-out must name different files")
|
||||
|
||||
Reference in new issue
Block a user