Skip to content

Commit

Permalink
Make restart requests synchronous
Browse files Browse the repository at this point in the history
  • Loading branch information
NipunaRanasinghe committed Jan 9, 2025
1 parent fa35b79 commit cbab642
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,23 +449,21 @@ public CompletableFuture<Void> stepOut(StepOutArguments args) {

@Override
public CompletableFuture<Void> restart(RestartArguments args) {
return CompletableFuture.supplyAsync(() -> {
if (context.getDebugMode() == ExecutionContext.DebugMode.ATTACH) {
outputLogger.sendErrorOutput("Restart operation is not supported in remote debug mode.");
return null;
}
if (context.getDebugMode() == ExecutionContext.DebugMode.ATTACH) {
outputLogger.sendErrorOutput("Restart operation is not supported in remote debug mode.");

Check warning on line 453 in misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/JBallerinaDebugServer.java

View check run for this annotation

Codecov / codecov/patch

misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/JBallerinaDebugServer.java#L453

Added line #L453 was not covered by tests
return CompletableFuture.completedFuture(null);
}

try {
resetServer();
launchDebuggeeProgram();
} catch (Exception e) {
LOGGER.error("Failed to restart the Ballerina program due to: {}", e.getMessage(), e);
outputLogger.sendErrorOutput("Failed to restart the Ballerina program");
terminateDebugSession(context.getDebuggeeVM() != null, true);
}
try {
resetServer();
launchDebuggeeProgram();
} catch (Exception e) {
LOGGER.error("Failed to restart the Ballerina program due to: {}", e.getMessage(), e);
outputLogger.sendErrorOutput("Failed to restart the Ballerina program");

Check warning on line 462 in misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/JBallerinaDebugServer.java

View check run for this annotation

Codecov / codecov/patch

misc/debug-adapter/modules/debug-adapter-core/src/main/java/org/ballerinalang/debugadapter/JBallerinaDebugServer.java#L461-L462

Added lines #L461 - L462 were not covered by tests
terminateDebugSession(context.getDebuggeeVM() != null, true);
}

return null;
});
return CompletableFuture.completedFuture(null);
}

private void launchDebuggeeProgram() throws Exception {
Expand Down

0 comments on commit cbab642

Please sign in to comment.