diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-06-29 14:17:38 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-06-30 02:23:13 -0400 |
| commit | 9547b304ce8c53574b3a877f8416898fbb8bea77 (patch) | |
| tree | 237870064c5868fdd68e093f50c7e415c480b614 | |
| parent | 6d262fab389df302c9a311fb44022d538d88b80e (diff) | |
| download | stasis-9547b304ce8c53574b3a877f8416898fbb8bea77.tar.gz | |
Tune conditions that dump errors from pip and conda during index resolutionbugfix-1003
* Don't print errors if the requested package is found/not-found. Only print real errors that prevent either of those conditions from being true.
* Move the check down so we can rely on the return code
| -rw-r--r-- | src/lib/core/conda.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/src/lib/core/conda.c b/src/lib/core/conda.c index bf27d21..044400d 100644 --- a/src/lib/core/conda.c +++ b/src/lib/core/conda.c @@ -310,33 +310,6 @@ int pkg_index_provides(int mode, const char *index, const char *spec, const char } } - if (status != 0) { - SYSERROR("Command exited non-zero (%d)", status); - for (size_t i = 0; i < sizeof(logfile) / sizeof(logfile[0]); i++) { - const char *stream_name = i == 0 ? "stdout" : "stderr"; - if (!logfile_st[i].st_size) { - continue; - } - SYSDEBUG("(%s): %s", stream_name, logfile[i]); - FILE *fp = fdopen(logfile_fd[i], "r"); - if (!fp) { - remove(logfile[i]); - return -1; - } - - fflush(stdout); - fflush(stderr); - - char line[STASIS_BUFSIZ] = {0}; - while (fgets(line, sizeof(line) - 1, fp) != NULL) { - SYSINFO("(%s): %s", stream_name, strip(line)); - } - - fflush(stderr); - fclose(fp); - } - } - if (WTERMSIG(proc.returncode)) { // This gets its own return value because if the external program // received a signal, even its status is zero, it's not reliable @@ -372,6 +345,34 @@ int pkg_index_provides(int mode, const char *index, const char *spec, const char final = PKG_NOT_FOUND; } + if (final != PKG_FOUND && final != PKG_NOT_FOUND) { + SYSERROR("Command exited non-zero (%d)", status); + for (size_t i = 0; i < sizeof(logfile) / sizeof(logfile[0]); i++) { + const char *stream_name = i == 0 ? "stdout" : "stderr"; + if (!logfile_st[i].st_size) { + continue; + } + SYSDEBUG("(%s): %s", stream_name, logfile[i]); + FILE *fp = fdopen(logfile_fd[i], "r"); + if (!fp) { + remove(logfile[i]); + return -1; + } + + fflush(stdout); + fflush(stderr); + + char line[STASIS_BUFSIZ] = {0}; + while (fgets(line, sizeof(line) - 1, fp) != NULL) { + SYSINFO("(%s): %s", stream_name, strip(line)); + } + + fflush(stderr); + fclose(fp); + } + } + + // Remove log files for (size_t i = 0; i < sizeof(logfile) / sizeof(logfile[0]); i++) { remove(logfile[stdout_stream]); |
