Skip to content

Commit

Permalink
Write the version to stderr as before, but only if stderr is actually…
Browse files Browse the repository at this point in the history
… captured and not just printed alongside with stdout.

See #5504
  • Loading branch information
scoder committed Jul 12, 2023
1 parent 8169009 commit 36a3702
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cython/Compiler/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,10 @@ def main(command_line = 0):
if options.show_version:
from .. import __version__
print("Cython version %s" % __version__)
# For legacy reasons, we also write the version to stderr.
# New tools should expect it in stdout, but existing ones still pipe from stderr.
if not sys.stderr.isatty():
sys.stderr.write("Cython version %s\n" % __version__)
if options.working_path!="":
os.chdir(options.working_path)
try:
Expand Down

0 comments on commit 36a3702

Please sign in to comment.