From 7acc4c7dfe4b79e2bf1c993e84fd5fcd6855f292 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Tue, 18 Jan 2022 17:14:42 +0000 Subject: [PATCH] 8280058: JFR: StreamUtils::getJfrRepository(Process) should print stdout and stderr Reviewed-by: mgronlun --- test/lib/jdk/test/lib/jfr/StreamingUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/lib/jdk/test/lib/jfr/StreamingUtils.java b/test/lib/jdk/test/lib/jfr/StreamingUtils.java index 7461cfd0b63..427a4eb4262 100644 --- a/test/lib/jdk/test/lib/jfr/StreamingUtils.java +++ b/test/lib/jdk/test/lib/jfr/StreamingUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,8 +43,10 @@ public class StreamingUtils { public static Path getJfrRepository(Process process) throws Exception { while (true) { if (!process.isAlive()) { - String msg = String.format("Process (pid = %d) is no longer alive, exit value = %d", + String msg = String.format("Process (pid = %d) is no longer alive, exit value = %d\n", process.pid(), process.exitValue()); + msg += "Stderr: " + new String(process.getErrorStream().readAllBytes()) + "\n"; + msg += "Stdout: " + new String(process.getInputStream().readAllBytes()) + "\n"; throw new RuntimeException(msg); }