diff options
author | Brian Harring <ferringb@gmail.com> | 2023-01-10 02:00:23 -0800 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-01-17 22:46:03 +0200 |
commit | 67f57cab42a865339096d0305f7773006dafab2e (patch) | |
tree | 6be311b3285d539a44104141d77dac20c8c72e54 | |
parent | refactor(sync): hide FD passing as an internal thing. (diff) | |
download | pkgcore-67f57cab42a865339096d0305f7773006dafab2e.tar.gz pkgcore-67f57cab42a865339096d0305f7773006dafab2e.tar.bz2 pkgcore-67f57cab42a865339096d0305f7773006dafab2e.zip |
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@gmail.com>
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r-- | src/pkgcore/sync/base.py | 8 |
1 files changed, 8 insertions, 0 deletions
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 ) |