On Wed, Aug 06, 2025 at 05:48:29PM +0100, Daniel P. Berrangé wrote:
> This avoids callers needing to use the UNIX-only /dev/stdout
> workaround.
> 
> Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>
> ---
>  scripts/tracetool/__init__.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
> index 0f33758870..c8fd3a7ddc 100644
> --- a/scripts/tracetool/__init__.py
> +++ b/scripts/tracetool/__init__.py
> @@ -38,8 +38,12 @@ def error(*lines):
>  
>  def out_open(filename):
>      global out_filename, out_fobj
> -    out_filename = posix_relpath(filename)
> -    out_fobj = open(filename, 'wt')
> +    if filename == "-":
> +        out_filename = "[stdout]"

A few lines above:

  out_filename = '<none>'
  out_fobj = sys.stdout

Stick to '<none>' here for consistency?

> +        out_fobj = sys.stdout
> +    else:
> +        out_filename = posix_relpath(filename)

I have CCed Oleg in case he spots any portability issues, but I think
this should still work on Windows.

> +        out_fobj = open(filename, 'wt')
>  
>  def out(*lines, **kwargs):
>      """Write a set of output lines.
> -- 
> 2.50.1
> 

Attachment: signature.asc
Description: PGP signature

Reply via email to