10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package jdk.test.lib; 25 26 import java.io.ByteArrayOutputStream; 27 import java.io.IOException; 28 import java.lang.management.ManagementFactory; 29 import java.lang.management.RuntimeMXBean; 30 import java.lang.reflect.Field; 31 import java.lang.reflect.Method; 32 import java.util.ArrayList; 33 import java.util.Collections; 34 import java.util.List; 35 36 public final class ProcessTools { 37 38 private ProcessTools() { 39 } 40 41 /** 42 * Pumps stdout and stderr from running the process into a String. 43 * 44 * @param processHandler ProcessHandler to run. 45 * @return Output from process. 46 * @throws IOException If an I/O error occurs. 47 */ 48 public static OutputBuffer getOutput(ProcessBuilder processBuilder) throws IOException { 49 return getOutput(processBuilder.start()); 50 } 51 | 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package jdk.test.lib; 25 26 import java.io.ByteArrayOutputStream; 27 import java.io.IOException; 28 import java.lang.management.ManagementFactory; 29 import java.lang.management.RuntimeMXBean; 30 import java.util.ArrayList; 31 import java.util.Collections; 32 import java.util.List; 33 34 public final class ProcessTools { 35 36 private ProcessTools() { 37 } 38 39 /** 40 * Pumps stdout and stderr from running the process into a String. 41 * 42 * @param processHandler ProcessHandler to run. 43 * @return Output from process. 44 * @throws IOException If an I/O error occurs. 45 */ 46 public static OutputBuffer getOutput(ProcessBuilder processBuilder) throws IOException { 47 return getOutput(processBuilder.start()); 48 } 49 |