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
)