Skip to content

Commit

Permalink
Further attempt at capturing reaper error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Aug 11, 2022
1 parent 68aa9c4 commit 65d997d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (buildNumber) {
fileset(dir: projectDir) {
Set<File> fileSet = fileTree(projectDir) {
include("**/*.hprof")
include("**/reaper.log")
include("**/build/test-results/**/*.xml")
include("**/build/testclusters/**")
exclude("**/build/testclusters/**/data/**")
exclude("**/build/testclusters/**/distro/**")
Expand All @@ -48,6 +48,8 @@ if (buildNumber) {
}

fileset(dir: "${gradle.gradleUserHomeDir}/workers", followsymlinks: false)

fileset(dir: "${project.projectDir}/.gradle/reaper", followsymlinks: false)
}
} catch (Exception e) {
logger.lifecycle("Failed to archive additional logs", e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ private void reap() {
delete(inputFile);
}
}
} catch (Exception e) {
} catch (Throwable e) {
failed = true;
logFailure("Failed to reap inputs", e);
}
}

private void logFailure(String message, Exception e) {
private void logFailure(String message, Throwable e) {
System.err.println(message);
if (e != null) {
e.printStackTrace(System.err);
}
failed = true;
}

private void delete(Path toDelete) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void shutdown() {
logger.info("Waiting for reaper to exit normally");
if (reaperProcess.waitFor() != 0) {
Path inputDir = getParameters().getInputDir().get().getAsFile().toPath();
throw new GradleException("Reaper process failed. Check log at " + inputDir.resolve("error.log") + " for details");
throw new GradleException("Reaper process failed. Check log at " + inputDir.resolve("reaper.log") + " for details");
}
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down Expand Up @@ -111,7 +111,7 @@ private synchronized void ensureReaperStarted() {
builder.redirectInput(ProcessBuilder.Redirect.PIPE);
File logFile = logFilePath().toFile();
builder.redirectOutput(logFile);
builder.redirectError(logFile);
builder.redirectErrorStream();
reaperProcess = builder.start();
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down

0 comments on commit 65d997d

Please sign in to comment.