Skip to content

Commit 4803939

Browse files
ruromeroclaude
andcommitted
fix: check pip exit code and drain streams concurrently
Use runProcessGetFullOutput instead of runProcessGetOutput so that stdout/stderr are drained in parallel (avoiding deadlock) and a non-zero exit code throws a clear error instead of silently returning stderr. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b782cb2 commit 4803939

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/main/java/io/github/guacsec/trustifyda/providers/PythonPyprojectProvider.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,16 @@ String getPipReportOutput(Path manifestDir) {
140140
}
141141

142142
String pip = findPipBinary();
143-
return Operations.runProcessGetOutput(
144-
manifestDir,
145-
new String[] {pip, "install", "--dry-run", "--ignore-installed", "--report", "-", "."});
143+
String[] cmd = {pip, "install", "--dry-run", "--ignore-installed", "--report", "-", "."};
144+
Operations.ProcessExecOutput result =
145+
Operations.runProcessGetFullOutput(manifestDir, cmd, null);
146+
if (result.getExitCode() != 0) {
147+
throw new RuntimeException(
148+
String.format(
149+
"pip report command failed with exit code %d: %s",
150+
result.getExitCode(), result.getError()));
151+
}
152+
return result.getOutput();
146153
}
147154

148155
private String findPipBinary() {

0 commit comments

Comments
 (0)