diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-26 21:59:00 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-26 21:59:00 -0400 |
| commit | 6df309db7afa3f2c44d5f7069534484da7523cfd (patch) | |
| tree | 0b8d8040d8b9254ec03a1841882b5ef04f950f7a /src | |
| parent | f4bccc6b21c8eec58bb08bc22115a93a2352868d (diff) | |
| download | stasis-6df309db7afa3f2c44d5f7069534484da7523cfd.tar.gz | |
pkg_index_provides: When in debug mode show log data regardless
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/core/conda.c | 21 |
1 files changed, 19 insertions, 2 deletions
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); |
