From 6df309db7afa3f2c44d5f7069534484da7523cfd Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 26 Apr 2026 21:59:00 -0400 Subject: pkg_index_provides: When in debug mode show log data regardless --- src/lib/core/conda.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/core/conda.c b/src/lib/core/conda.c index 731cf80..2a76c30 100644 --- a/src/lib/core/conda.c +++ b/src/lib/core/conda.c @@ -187,11 +187,24 @@ int pkg_index_provides(int mode, const char *index, const char *spec) { return PKG_INDEX_PROVIDES_E_INTERNAL_MODE_UNKNOWN; } +#if defined(DEBUG) + const int debug_log = 1; +#else + const debug_log = 0; +#endif + // Print errors only when shell() itself throws one // If some day we want to see the errors thrown by pip too, use this // condition instead: (status != 0) + if (debug_log) { + SYSDEBUG("Executing: %s", cmd); + } status = shell(&proc, cmd); - if (status < 0) { + + if (debug_log) { + SYSDEBUG("Log file: %s", logfile); + } + if (status < 0 || debug_log) { FILE *fp = fdopen(logfd, "r"); if (!fp) { remove(logfile); @@ -201,7 +214,11 @@ int pkg_index_provides(int mode, const char *index, const char *spec) { fflush(stdout); fflush(stderr); while (fgets(line, sizeof(line) - 1, fp) != NULL) { - fprintf(stderr, "%s", line); + if (debug_log) { + SYSDEBUG("%s", strip(line)); + } else { + fprintf(stderr, "%s", line); + } } fflush(stderr); fclose(fp); -- cgit