< prev index next >

test/jdk/com/sun/jdi/lib/jdb/Jdb.java

Print this page

        

@@ -27,10 +27,11 @@
 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,13 +39,18 @@
 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(Arrays.asList(args));
+        pb.command().addAll(args);
         try {
             jdb = pb.start();
         } catch (IOException ex) {
             throw new RuntimeException("failed to launch pdb", ex);
         }

@@ -205,10 +211,14 @@
         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,11 +231,11 @@
 
         if (inputWriter.checkError()) {
             throw new RuntimeException("Unexpected IO error while writing command '" + cmd.cmd + "' to jdb stdin stream");
         }
 
-        return waitForPrompt(1, cmd.allowExit);
+        return waitForSimplePrompt ? waitForSimplePrompt(1, cmd.allowExit) : waitForPrompt(1, cmd.allowExit);
     }
 
     public List<String> command(String cmd) {
         return command(new JdbCommand(cmd));
     }
< prev index next >