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:
parent
f6d5404f45
commit
ff6c1ea5f3
|
|
@ -211,6 +211,7 @@ 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)
|
||||
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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue