in jetbrains-core/src/software/aws/toolkits/jetbrains/services/clouddebug/execution/CloudDebugRunState.kt [32:93]
override fun execute(executor: Executor?, runner: ProgramRunner<*>): ExecutionResult {
val project = environment.project
val descriptor = DefaultBuildDescriptor(
runConfigId(),
message("cloud_debug.execution.title"),
"/unused/location",
System.currentTimeMillis()
)
val buildView = BuildView(
project,
descriptor,
null,
object : ViewManager {
override fun isConsoleEnabledByDefault() = false
override fun isBuildContentView() = true
}
)
val workflowEmitter = BuildViewWorkflowEmitter.createEmitter(
buildView,
message("cloud_debug.execution.title"),
runConfigId()
)
val rootStep = CloudDebugWorkflow(settings, environment)
val context = Context()
context.putAttribute(Context.PROJECT_ATTRIBUTE, project)
val processHandler = CloudDebugProcessHandler(context)
ApplicationManager.getApplication().executeOnPooledThread {
val messageEmitter = workflowEmitter.createStepEmitter()
var result = Result.Succeeded
try {
workflowEmitter.workflowStarted()
rootStep.run(context, messageEmitter)
workflowEmitter.workflowCompleted()
processHandler.notifyProcessTerminated(0)
} catch (e: Throwable) {
result = Result.Failed
workflowEmitter.workflowFailed(e)
processHandler.notifyProcessTerminated(1)
}
try {
StopApplications(settings, isCleanup = true).run(context, messageEmitter, ignoreCancellation = true)
} catch (e: Exception) {
LOG.info(e) { "Always-run stopping applications step failed with message]: ${e.message}" }
}
try {
SetUpPortForwarding(settings, enable = false).run(context, messageEmitter, ignoreCancellation = true)
} catch (e: Exception) {
LOG.info(e) { "Always-run stopping port forwarding failed with: ${e.message}" }
}
ClouddebugTelemetry.startRemoteDebug(project, result, context.workflowToken)
}
return DefaultExecutionResult(buildView, processHandler)
}