< prev index next >
test/jdk/com/sun/jdi/lib/jdb/Jdb.java
Print this page
*** 27,36 ****
--- 27,37 ----
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
+ import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
*** 38,50 ****
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.Utils;
import jdk.test.lib.process.StreamPumper;
public class Jdb implements AutoCloseable {
public Jdb(String... args) {
ProcessBuilder pb = new ProcessBuilder(JDKToolFinder.getTestJDKTool("jdb"));
! pb.command().addAll(Arrays.asList(args));
try {
jdb = pb.start();
} catch (IOException ex) {
throw new RuntimeException("failed to launch pdb", ex);
}
--- 39,56 ----
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.Utils;
import jdk.test.lib.process.StreamPumper;
public class Jdb implements AutoCloseable {
+
public Jdb(String... args) {
+ this(Arrays.asList(args));
+ }
+
+ public Jdb(Collection<String> args) {
ProcessBuilder pb = new ProcessBuilder(JDKToolFinder.getTestJDKTool("jdb"));
! pb.command().addAll(args);
try {
jdb = pb.start();
} catch (IOException ex) {
throw new RuntimeException("failed to launch pdb", ex);
}
*** 205,214 ****
--- 211,224 ----
throw new RuntimeException("waitForPrompt timed out after " + (timeout/1000)
+ " seconds, looking for '" + promptPattern + "', in " + lines + " lines");
}
public List<String> command(JdbCommand cmd) {
+ return command(cmd, false);
+ }
+
+ public List<String> command(JdbCommand cmd, boolean waitForSimplePrompt) {
if (!jdb.isAlive()) {
if (cmd.allowExit) {
// return remaining output
return outputHandler.reset();
}
*** 221,231 ****
if (inputWriter.checkError()) {
throw new RuntimeException("Unexpected IO error while writing command '" + cmd.cmd + "' to jdb stdin stream");
}
! return waitForPrompt(1, cmd.allowExit);
}
public List<String> command(String cmd) {
return command(new JdbCommand(cmd));
}
--- 231,241 ----
if (inputWriter.checkError()) {
throw new RuntimeException("Unexpected IO error while writing command '" + cmd.cmd + "' to jdb stdin stream");
}
! return waitForSimplePrompt ? waitForSimplePrompt(1, cmd.allowExit) : waitForPrompt(1, cmd.allowExit);
}
public List<String> command(String cmd) {
return command(new JdbCommand(cmd));
}
< prev index next >