suspend fun execute()

in src/main/kotlin/org/jetbrains/tinygoplugin/services/TinyGoInfoExtractor.kt [85:119]


    suspend fun execute(
        sdkRoot: VirtualFile?,
        arguments: List<String>,
        failureListener: TinyGoExtractionFailureListener? = null,
        onFinish: (GoExecutor.ExecutionResult?, String) -> Unit,
    ) {
        val processHistory = GoHistoryProcessListener()
        val tinyGoExec = readAction { osManager.executableVFile(sdkRoot) } ?: return
        val executor = GoExecutor.`in`(project, null)
            .withExePath(tinyGoExec.path)
            .withParameters(arguments)
            .showNotifications(true, false)
            .withPtyEnabled(false)
        if (GoOsManager.isWindows()) {
            executor.withConsoleMode()
        }
        executor.executeWithProgress(true, true, processHistory, null) {
            val processOutput = processHistory.output.toString()
            if (it.status.ordinal == 0) {
                onFinish(it, processOutput)
            } else {
                val incompatibleVersionErrorMessage = generateMessageIfVersionErrorFound(project, processOutput)
                val errorMessage =
                    if (incompatibleVersionErrorMessage != null) {
                        incompatibleVersionErrorMessage
                    } else {
                        val detectionErrorMessage = TinyGoBundle.message(DETECTION_ERROR_MESSAGE)
                        TinyGoInfoExtractor.logger.error(detectionErrorMessage, processOutput)
                        detectionErrorMessage
                    }
                failureListener?.onExtractionFailure()
                notifyTinyGoNotConfigured(project, errorMessage)
            }
        }
    }