|
25 | 25 |
|
26 | 26 | import com.intuit.karate.core.MockServer; |
27 | 27 | import com.intuit.karate.core.RuntimeHookFactory; |
28 | | -import com.intuit.karate.debug.DapServer; |
29 | 28 | import com.intuit.karate.http.HttpServer; |
30 | 29 | import com.intuit.karate.http.RequestHandler; |
31 | 30 | import com.intuit.karate.http.ServerConfig; |
@@ -126,9 +125,6 @@ public class Main implements Callable<Void> { |
126 | 125 | description = "debug mode (optional port else dynamically chosen)") |
127 | 126 | int debugPort; |
128 | 127 |
|
129 | | - @Option(names = {"--debug-keepalive"}, defaultValue = "false", arity = "0..1", fallbackValue = "true", description = "keep debug server open for connections after disconnect") |
130 | | - boolean keepDebugServerAlive; |
131 | | - |
132 | 128 | @Option(names = {"-D", "--dryrun"}, description = "dry run, generate html reports only") |
133 | 129 | boolean dryRun; |
134 | 130 |
|
@@ -200,10 +196,10 @@ public static Main parseKarateOptions(String line) { |
200 | 196 | String[] args = Command.tokenize(line); |
201 | 197 | return CommandLine.populateCommand(new Main(), args); |
202 | 198 | } |
203 | | - |
| 199 | + |
204 | 200 | public static Main parseKarateArgs(List<String> args) { |
205 | 201 | return CommandLine.populateCommand(new Main(), args.toArray(new String[args.size()])); |
206 | | - } |
| 202 | + } |
207 | 203 |
|
208 | 204 | // matches ( -X XXX )* (XXX) |
209 | 205 | private static final Pattern CLI_ARGS = Pattern.compile("(\\s*-{1,2}\\w\\s\\S*\\s*)*(.*)$"); |
@@ -322,8 +318,15 @@ public Void call() throws Exception { |
322 | 318 | logger.info("deleted directory: {}", output); |
323 | 319 | } |
324 | 320 | if (debugPort != -1) { |
325 | | - DapServer server = new DapServer(debugPort, !keepDebugServerAlive); |
326 | | - server.waitSync(); |
| 321 | + try { |
| 322 | + Class clazz = Class.forName("io.karatelabs.debug.Main"); |
| 323 | + Method method = clazz.getMethod("main", String[].class); |
| 324 | + String[] params = new String[]{debugPort + ""}; |
| 325 | + method.invoke(null, (Object) params); |
| 326 | + } catch (Exception e) { |
| 327 | + String message = "error: debug server failed, is 'karate-debugserver' added as a dependency ?"; |
| 328 | + System.out.println(message); |
| 329 | + } |
327 | 330 | return null; |
328 | 331 | } |
329 | 332 | if (paths != null) { |
|
0 commit comments