qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael Roth" <michael.roth@amd.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Mads Ynddal" <mads@ynddal.dk>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	oleg.tolmatcev@gmail.com
Subject: Re: [PATCH v3 5/8] tracetool: support "-" as a shorthand for stdout
Date: Thu, 7 Aug 2025 15:46:08 -0400	[thread overview]
Message-ID: <20250807194608.GF51368@fedora> (raw)
In-Reply-To: <20250806164832.1382919-6-berrange@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

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é <berrange@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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2025-08-07 19:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-06 16:48 [PATCH v3 0/8] tracetool: add test suite to improve reviewability Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 1/8] checkpatch: cull trailing '*/' in SPDX check Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 2/8] tracetool: eliminate trailing whitespace in C format Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 3/8] tracetool: avoid space after "*" in arg types Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 4/8] tracetool: include SPDX-License-Identifier in generated files Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 5/8] tracetool: support "-" as a shorthand for stdout Daniel P. Berrangé
2025-08-07 19:46   ` Stefan Hajnoczi [this message]
2025-08-18 15:07     ` Daniel P. Berrangé
2025-08-18 17:55       ` Stefan Hajnoczi
2025-08-19 15:58         ` Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 6/8] tracetool: add test suite for tracetool with reference output Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 7/8] tracetool: drop the probe "__nocheck__" wrapping Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 8/8] qapi: switch to use QEMU_TEST_REGENERATE env var Daniel P. Berrangé
2025-08-08  6:46   ` Markus Armbruster
2025-08-18 15:09     ` Daniel P. Berrangé
2025-08-25 12:01       ` Markus Armbruster
2025-08-27 14:11         ` Daniel P. Berrangé
2025-08-07 20:06 ` [PATCH v3 0/8] tracetool: add test suite to improve reviewability Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250807194608.GF51368@fedora \
    --to=stefanha@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=mads@ynddal.dk \
    --cc=michael.roth@amd.com \
    --cc=oleg.tolmatcev@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).