public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/sync/
Date: Tue, 17 Jan 2023 20:46:16 +0000 (UTC)	[thread overview]
Message-ID: <1673988363.67f57cab42a865339096d0305f7773006dafab2e.arthurzam@gentoo> (raw)

commit:     67f57cab42a865339096d0305f7773006dafab2e
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Tue Jan 10 10:00:23 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 17 20:46:03 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=67f57cab

fix(sync): Add loggger.debug() of the sync command actually being invoked.

Additionally, since we know the sync subsystem was written before basic sanity
of the frontend, and we know that it invokes processes that write to stdout/stderr,
force a flush of those handles to ensure that we don't wind up with interlaced output
from two processes.

The need to bury a flush here is a sign that the abstraction needs redesign, but
that's a problem for a later date.

Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcore/sync/base.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/pkgcore/sync/base.py b/src/pkgcore/sync/base.py
index 1114532fb..f015cd2c0 100644
--- a/src/pkgcore/sync/base.py
+++ b/src/pkgcore/sync/base.py
@@ -14,6 +14,7 @@ __all__ = (
 import os
 import pwd
 import stat
+import sys
 import typing
 from importlib import import_module
 
@@ -22,6 +23,7 @@ from snakeoil import process
 from .. import os_data
 from ..config.hint import ConfigHint, configurable
 from ..exceptions import PkgcoreUserException
+from ..log import logger
 
 
 class SyncError(PkgcoreUserException):
@@ -195,6 +197,12 @@ class ExternalSyncer(Syncer):
         # Note: stderr is explicitly forced to stdout since that's how it was originally done.
         # This can be changed w/ a discussion.
         kwargs.setdefault("fd_pipes", {1: 1, 2: 1})
+        logger.debug("sync invoking command %r, kwargs %r", command, kwargs)
+        # since we're intermixing two processes writing to stdout/stderr- us, and what we're invoking-
+        # force a flush to keep output from being interlaced.  This is not hugely optimal, but
+        # the CLI/observability integration needs refactoring anyways.
+        sys.stdout.flush()
+        sys.stderr.flush()
         return process.spawn.spawn(
             command, uid=self.uid, gid=self.gid, env=self.env, **kwargs
         )


             reply	other threads:[~2023-01-17 20:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 20:46 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-01-20  8:01 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/sync/ Arthur Zamarin
2024-03-09 18:05 Arthur Zamarin

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=1673988363.67f57cab42a865339096d0305f7773006dafab2e.arthurzam@gentoo \
    --to=arthurzam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /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