@@ -15,8 +15,8 @@ import kotlinx.coroutines.delay
15
15
import kotlinx.coroutines.flow.StateFlow
16
16
import kotlinx.coroutines.flow.first
17
17
import kotlinx.coroutines.launch
18
+ import kotlinx.coroutines.runBlocking
18
19
import kotlinx.coroutines.time.withTimeout
19
- import kotlinx.coroutines.yield
20
20
import okhttp3.OkHttpClient
21
21
import java.net.HttpURLConnection
22
22
import java.net.URI
@@ -152,21 +152,21 @@ open class CoderProtocolHandler(
152
152
reInitialize(restClient, cli)
153
153
154
154
val environmentId = " ${workspace.name} .${agent.name} "
155
- context.cs.launch {
156
- context.ui.showWindow( )
157
- context.envPageManager.showPluginEnvironmentsPage( true )
158
- context.envPageManager.showEnvironmentPage(environmentId, false )
159
- val productCode = params.ideProductCode ()
160
- val buildNumber = params.ideBuildNumber()
161
- if ( ! productCode.isNullOrBlank() && ! buildNumber.isNullOrBlank()) {
155
+ context.ui.showWindow()
156
+ context.envPageManager.showPluginEnvironmentsPage( true )
157
+ context.envPageManager.showEnvironmentPage(environmentId, false )
158
+ val productCode = params.ideProductCode( )
159
+ val buildNumber = params.ideBuildNumber ()
160
+ if ( ! productCode.isNullOrBlank() && ! buildNumber.isNullOrBlank()) {
161
+ context.cs.launch {
162
162
val ideVersion = " $productCode -$buildNumber "
163
163
context.logger.info(" installing $ideVersion on $environmentId " )
164
- context.ideOrchestrator.prepareClient(environmentId, ideVersion)
164
+ runBlocking {
165
+ context.ideOrchestrator.prepareClient(environmentId, ideVersion)
166
+ }
167
+ context.logger.info(" launching $ideVersion on $environmentId " )
168
+ context.ideOrchestrator.connectToIde(environmentId, ideVersion, null )
165
169
}
166
- // without a yield or a delay(0) the env page does not show up. My assumption is that
167
- // the coroutine is finishing too fast without giving enough time to compose main thread
168
- // to catch the state change. Yielding gives other coroutines the chance to run
169
- yield ()
170
170
}
171
171
}
172
172
0 commit comments