mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
PY-82119 Packaging: Fix env tests for conda
Signed-off-by: Nikita.Ashihmin <nikita.ashihmin@jetbrains.com> GitOrigin-RevId: 47286211e8ca894aa2e04c3f65528a2ab22fc37c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3156c22dee
commit
024d2ae147
@@ -2,7 +2,6 @@
|
||||
package com.intellij.python.hatch.cli
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.platform.eel.getOr
|
||||
import com.intellij.platform.eel.provider.utils.EelProcessExecutionResultInfo
|
||||
import com.intellij.platform.eel.provider.utils.sendWholeText
|
||||
import com.intellij.platform.eel.provider.utils.stderrString
|
||||
@@ -12,7 +11,6 @@ import com.intellij.python.hatch.PyHatchBundle
|
||||
import com.intellij.python.hatch.runtime.HatchConstants
|
||||
import com.intellij.python.hatch.runtime.HatchRuntime
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import io.github.z4kn4fein.semver.Version
|
||||
import io.github.z4kn4fein.semver.VersionFormatException
|
||||
@@ -22,7 +20,7 @@ import java.nio.file.Path
|
||||
/**
|
||||
* Handles hatch-specific errors, runs [transformer] only on outputs with codes 0 or 1 without tracebacks.
|
||||
*/
|
||||
private suspend fun <T> HatchRuntime.executeAndHandleErrors(vararg arguments: String, transformer: ProcessOutputTransformer<T>): PyExecResult<T> {
|
||||
private suspend fun <T> HatchRuntime.executeAndHandleErrors(vararg arguments: String, transformer: ProcessOutputTransformer<T>): PyResult<T> {
|
||||
val errorHandlerTransformer: ProcessOutputTransformer<T> = { output ->
|
||||
when {
|
||||
output.exitCode !in 0..1 -> Result.failure(null)
|
||||
@@ -42,7 +40,7 @@ private suspend fun <T> HatchRuntime.executeAndMatch(
|
||||
expectedOutput: Regex,
|
||||
outputContentSupplier: (EelProcessExecutionResultInfo) -> String = { it.stdoutString },
|
||||
transformer: (MatchResult) -> Result<T, @NlsSafe String?>,
|
||||
): PyExecResult<T> {
|
||||
): PyResult<T> {
|
||||
return this.executeAndHandleErrors(*arguments) { processOutput ->
|
||||
if (processOutput.exitCode != 0) return@executeAndHandleErrors Result.failure(null)
|
||||
|
||||
@@ -61,11 +59,11 @@ sealed class HatchCommand(private val command: Array<String>, protected val runt
|
||||
@Suppress("unused")
|
||||
constructor(command: String, runtime: HatchRuntime) : this(arrayOf(command), runtime)
|
||||
|
||||
protected suspend fun <T> executeAndHandleErrors(vararg arguments: String, transformer: ProcessOutputTransformer<T>): PyExecResult<T> {
|
||||
protected suspend fun <T> executeAndHandleErrors(vararg arguments: String, transformer: ProcessOutputTransformer<T>): PyResult<T> {
|
||||
return runtime.executeAndHandleErrors(*command, *arguments, transformer = transformer)
|
||||
}
|
||||
|
||||
protected suspend fun <T> executeAndMatch(vararg arguments: String, expectedOutput: Regex, transformer: (MatchResult) -> Result<T, @NlsSafe String?>): PyExecResult<T> {
|
||||
protected suspend fun <T> executeAndMatch(vararg arguments: String, expectedOutput: Regex, transformer: (MatchResult) -> Result<T, @NlsSafe String?>): PyResult<T> {
|
||||
return runtime.executeAndMatch(*command, *arguments, expectedOutput = expectedOutput, transformer = transformer)
|
||||
}
|
||||
}
|
||||
@@ -74,12 +72,12 @@ class HatchCli(private val runtime: HatchRuntime) {
|
||||
/**
|
||||
* Build a project
|
||||
*/
|
||||
fun build(): PyExecResult<Unit> = TODO()
|
||||
fun build(): PyResult<Unit> = TODO()
|
||||
|
||||
/**
|
||||
* Remove build artifacts
|
||||
*/
|
||||
fun clean(): PyExecResult<Unit> = TODO()
|
||||
fun clean(): PyResult<Unit> = TODO()
|
||||
|
||||
/**
|
||||
* Manage the config file
|
||||
@@ -99,7 +97,7 @@ class HatchCli(private val runtime: HatchRuntime) {
|
||||
/**
|
||||
* Format and lint source code
|
||||
*/
|
||||
fun fmt(): PyExecResult<Unit> = TODO()
|
||||
fun fmt(): PyResult<Unit> = TODO()
|
||||
|
||||
/**
|
||||
* Create or initialize a project.
|
||||
@@ -128,7 +126,8 @@ class HatchCli(private val runtime: HatchRuntime) {
|
||||
if (initExistingProject) {
|
||||
try {
|
||||
eelProcess.sendWholeText("$projectName\n")
|
||||
} catch (error: IOException) {
|
||||
}
|
||||
catch (error: IOException) {
|
||||
return@executeInteractive Result.failure("Failed to write to process: ${error.localizedMessage}")
|
||||
}
|
||||
}
|
||||
@@ -144,7 +143,7 @@ class HatchCli(private val runtime: HatchRuntime) {
|
||||
/**
|
||||
* Publish build artifacts
|
||||
*/
|
||||
fun publish(): PyExecResult<Unit> = TODO()
|
||||
fun publish(): PyResult<Unit> = TODO()
|
||||
|
||||
/**
|
||||
* Manage Python installations
|
||||
@@ -154,7 +153,7 @@ class HatchCli(private val runtime: HatchRuntime) {
|
||||
/**
|
||||
* Run commands within project environments
|
||||
*/
|
||||
suspend fun run(envName: String? = null, vararg command: String): PyExecResult<String> {
|
||||
suspend fun run(envName: String? = null, vararg command: String): PyResult<String> {
|
||||
val envRuntime = envName?.let { runtime.withEnv(HatchConstants.AppEnvVars.ENV to it) } ?: runtime
|
||||
return envRuntime.executeAndHandleErrors("run", *command) { output ->
|
||||
if (output.exitCode != 0) return@executeAndHandleErrors Result.failure(null)
|
||||
@@ -175,14 +174,14 @@ class HatchCli(private val runtime: HatchRuntime) {
|
||||
/**
|
||||
* Enter a shell within a project's environment
|
||||
*/
|
||||
fun shell(): PyExecResult<Unit> = TODO()
|
||||
fun shell(): PyResult<Unit> = TODO()
|
||||
|
||||
data class HatchStatus(val project: String, val location: Path, val config: Path)
|
||||
|
||||
/**
|
||||
* Show information about the current environment
|
||||
*/
|
||||
suspend fun status(): PyExecResult<HatchStatus> {
|
||||
suspend fun status(): PyResult<HatchStatus> {
|
||||
val expectedOutput = """^\[Project] - (.*)\n\[Location] - (.*)\n\[Config] - (.*)\n$""".toRegex()
|
||||
|
||||
return runtime.executeAndMatch("status", expectedOutput = expectedOutput, outputContentSupplier = { it.stderrString }) { matchResult ->
|
||||
@@ -199,14 +198,14 @@ class HatchCli(private val runtime: HatchRuntime) {
|
||||
/**
|
||||
* Run tests
|
||||
*/
|
||||
fun test(): PyExecResult<Unit> = TODO()
|
||||
fun test(): PyResult<Unit> = TODO()
|
||||
|
||||
/**
|
||||
* View a project's version.
|
||||
*
|
||||
* @return Project Version
|
||||
*/
|
||||
suspend fun getVersion(): PyExecResult<Version> {
|
||||
suspend fun getVersion(): PyResult<Version> {
|
||||
return runtime.executeAndHandleErrors("version") { processOutput ->
|
||||
val output = processOutput.takeIf { it.exitCode == 0 }?.stdoutString?.trim()
|
||||
?: return@executeAndHandleErrors Result.failure(null)
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.python.hatch.cli
|
||||
|
||||
import com.intellij.python.community.execService.ZeroCodeStdoutTransformer
|
||||
import com.intellij.python.hatch.runtime.HatchRuntime
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
|
||||
/**
|
||||
* Manage environment dependencies
|
||||
@@ -12,28 +12,28 @@ class HatchConfig(runtime: HatchRuntime) : HatchCommand("config", runtime) {
|
||||
/**
|
||||
* Open the config location in your file manager
|
||||
*/
|
||||
suspend fun explore(): PyExecResult<String> {
|
||||
suspend fun explore(): PyResult<String> {
|
||||
return executeAndHandleErrors("explore", transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the location of the config file
|
||||
*/
|
||||
suspend fun find(): PyExecResult<String> {
|
||||
suspend fun find(): PyResult<String> {
|
||||
return executeAndHandleErrors("find", transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the config file to default settings
|
||||
*/
|
||||
suspend fun restore(): PyExecResult<String> {
|
||||
suspend fun restore(): PyResult<String> {
|
||||
return executeAndHandleErrors("restore", transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign values to config file entries
|
||||
*/
|
||||
suspend fun set(key: String, value: String): PyExecResult<String> {
|
||||
suspend fun set(key: String, value: String): PyResult<String> {
|
||||
return executeAndHandleErrors("set", key, value, transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class HatchConfig(runtime: HatchRuntime) : HatchCommand("config", runtime) {
|
||||
*
|
||||
* @param all Do not scrub secret fields
|
||||
*/
|
||||
suspend fun show(all: Boolean? = null): PyExecResult<String> {
|
||||
suspend fun show(all: Boolean? = null): PyResult<String> {
|
||||
val options = listOf(all to "--all").makeOptions()
|
||||
return executeAndHandleErrors("show", *options, transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class HatchConfig(runtime: HatchRuntime) : HatchCommand("config", runtime) {
|
||||
/**
|
||||
* Update the config file with any new fields
|
||||
*/
|
||||
suspend fun update(): PyExecResult<String> {
|
||||
suspend fun update(): PyResult<String> {
|
||||
return executeAndHandleErrors("update", transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.intellij.python.hatch.cli
|
||||
|
||||
import com.intellij.python.community.execService.ZeroCodeStdoutTransformer
|
||||
import com.intellij.python.hatch.runtime.HatchRuntime
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
|
||||
enum class Scope(val options: Array<String>) {
|
||||
All(emptyArray()),
|
||||
@@ -18,7 +18,7 @@ class HatchDep(runtime: HatchRuntime) : HatchCommand("dep", runtime) {
|
||||
/**
|
||||
* Output a hash of the currently defined dependencies
|
||||
**/
|
||||
suspend fun hash(scope: Scope = Scope.All): PyExecResult<String> {
|
||||
suspend fun hash(scope: Scope = Scope.All): PyResult<String> {
|
||||
return executeAndHandleErrors("hash", *scope.options, transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class HatchDepShow(runtime: HatchRuntime) : HatchCommand(arrayOf("dep", "show"),
|
||||
*
|
||||
* @param features only show the dependencies of the specified features
|
||||
*/
|
||||
suspend fun requirements(scope: Scope = Scope.All, features: List<String>? = null): PyExecResult<String> {
|
||||
suspend fun requirements(scope: Scope = Scope.All, features: List<String>? = null): PyResult<String> {
|
||||
val options = features?.flatMap { listOf("--feature", it) }?.toTypedArray() ?: arrayOf("--all")
|
||||
return executeAndHandleErrors("requirements", *scope.options, *options, transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class HatchDepShow(runtime: HatchRuntime) : HatchCommand(arrayOf("dep", "show"),
|
||||
/**
|
||||
* Enumerate dependencies in a tabular format.
|
||||
*/
|
||||
suspend fun table(scope: Scope = Scope.All): PyExecResult<String> {
|
||||
suspend fun table(scope: Scope = Scope.All): PyResult<String> {
|
||||
val options = listOf(null to "--lines", true to "--ascii").makeOptions()
|
||||
return executeAndHandleErrors("table", *scope.options, *options, transformer = ZeroCodeStdoutTransformer)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.python.hatch.runtime.HatchRuntime
|
||||
import com.jetbrains.python.PythonHomePath
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.errorProcessing.ExecError
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
@@ -130,7 +130,7 @@ class HatchEnv(runtime: HatchRuntime) : HatchCommand("env", runtime) {
|
||||
*
|
||||
* @return true if created, false if already exists
|
||||
*/
|
||||
suspend fun create(envName: String? = null): PyExecResult<CreateResult> {
|
||||
suspend fun create(envName: String? = null): PyResult<CreateResult> {
|
||||
val arguments = if (envName == null) emptyArray() else arrayOf(envName)
|
||||
return executeAndHandleErrors("create", *arguments) {
|
||||
val actualEnvName = envName ?: DEFAULT_ENV_NAME
|
||||
@@ -148,7 +148,7 @@ class HatchEnv(runtime: HatchRuntime) : HatchCommand("env", runtime) {
|
||||
*
|
||||
* @return path to environment
|
||||
*/
|
||||
suspend fun find(envName: String? = null): PyExecResult<PythonHomePath?> {
|
||||
suspend fun find(envName: String? = null): PyResult<PythonHomePath?> {
|
||||
val arguments = if (envName == null) emptyArray() else arrayOf(envName)
|
||||
return executeAndHandleErrors("find", *arguments) {
|
||||
when (it.exitCode) {
|
||||
@@ -183,7 +183,7 @@ class HatchEnv(runtime: HatchRuntime) : HatchCommand("env", runtime) {
|
||||
* - [RemoveResult.CantRemoveActiveEnvironment] if the environment cannot be removed because it is currently active.
|
||||
* - An error wrapped in [ExecError] in case of execution failure.
|
||||
*/
|
||||
suspend fun remove(envName: String? = null): PyExecResult<RemoveResult> {
|
||||
suspend fun remove(envName: String? = null): PyResult<RemoveResult> {
|
||||
val arguments = if (envName == null) emptyArray() else arrayOf(envName)
|
||||
return executeAndHandleErrors("remove", *arguments) {
|
||||
val actualEnvName = envName ?: DEFAULT_ENV_NAME
|
||||
@@ -205,7 +205,7 @@ class HatchEnv(runtime: HatchRuntime) : HatchCommand("env", runtime) {
|
||||
* - [HatchDetailedEnvironments] if operation is successful.
|
||||
* - An error wrapped in [ExecError] if an execution failure occurs.
|
||||
*/
|
||||
suspend fun showWithDetails(vararg envs: String): PyExecResult<HatchDetailedEnvironments> {
|
||||
suspend fun showWithDetails(vararg envs: String): PyResult<HatchDetailedEnvironments> {
|
||||
return executeAndHandleErrors("show", "--json", *envs) { processOutput ->
|
||||
val output = processOutput.takeIf { it.exitCode == 0 }?.stdoutString
|
||||
?: return@executeAndHandleErrors Result.failure(null)
|
||||
@@ -232,7 +232,7 @@ class HatchEnv(runtime: HatchRuntime) : HatchCommand("env", runtime) {
|
||||
* - [HatchDetailedEnvironments] if operation is successful.
|
||||
* - An error wrapped in [ExecError] if an execution failure occurs.
|
||||
*/
|
||||
suspend fun show(vararg envs: String, internal: Boolean = false): PyExecResult<HatchEnvironments> {
|
||||
suspend fun show(vararg envs: String, internal: Boolean = false): PyResult<HatchEnvironments> {
|
||||
val options = listOf(internal to "--internal").makeOptions()
|
||||
|
||||
return executeAndMatch("show", "--ascii", *options, *envs, expectedOutput = SHOW_RESPONSE_REGEX) { matchResult ->
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.python.hatch.cli
|
||||
import com.intellij.platform.eel.provider.utils.stdoutString
|
||||
import com.intellij.python.hatch.runtime.HatchRuntime
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
@@ -62,7 +62,7 @@ class HatchProject(runtime: HatchRuntime) : HatchCommand("project", runtime) {
|
||||
/**
|
||||
* Display project metadata
|
||||
*/
|
||||
suspend fun metadata(): PyExecResult<Metadata> {
|
||||
suspend fun metadata(): PyResult<Metadata> {
|
||||
return executeAndHandleErrors("metadata") { processOutput ->
|
||||
val output = processOutput.takeIf { it.exitCode == 0 }?.stdoutString
|
||||
?: return@executeAndHandleErrors Result.failure(null)
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.platform.eel.provider.utils.stdoutString
|
||||
import com.intellij.python.hatch.cli.HatchPython.PythonInstallResponse.AbortReason
|
||||
import com.intellij.python.hatch.runtime.HatchRuntime
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import java.nio.file.Path
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ class HatchPython(runtime: HatchRuntime) : HatchCommand("python", runtime) {
|
||||
* @param parent Show the parent directory of the Python binary
|
||||
* @param dir The directory in which distributions reside
|
||||
*/
|
||||
suspend fun find(name: String, parent: Boolean? = null, dir: String? = null): PyExecResult<Path?> {
|
||||
suspend fun find(name: String, parent: Boolean? = null, dir: String? = null): PyResult<Path?> {
|
||||
val options = listOf(parent to "--parent").makeOptions() + buildDirOption(dir)
|
||||
|
||||
return executeAndHandleErrors("find", *options, name) { output ->
|
||||
@@ -129,7 +129,7 @@ class HatchPython(runtime: HatchRuntime) : HatchCommand("python", runtime) {
|
||||
private: Boolean? = null,
|
||||
update: Boolean? = null,
|
||||
dir: String? = null,
|
||||
): PyExecResult<PythonInstallResponse> {
|
||||
): PyResult<PythonInstallResponse> {
|
||||
val options = listOf(update to "--update", private to "--private").makeOptions() + buildDirOption(dir)
|
||||
return executeAndHandleErrors("install", *options, *names) { output ->
|
||||
Result.success(parsePythonInstallCommandOutput(output))
|
||||
@@ -144,7 +144,7 @@ class HatchPython(runtime: HatchRuntime) : HatchCommand("python", runtime) {
|
||||
* @param names Distributions to remove, you may select `all` to install all compatible distributions
|
||||
* @param dir The directory in which distributions reside
|
||||
*/
|
||||
suspend fun remove(vararg names: String = ALL_NAMES, dir: String? = null): PyExecResult<PythonRemoveResponse> {
|
||||
suspend fun remove(vararg names: String = ALL_NAMES, dir: String? = null): PyResult<PythonRemoveResponse> {
|
||||
return executeAndHandleErrors("remove", *buildDirOption(dir), *names) { processOutput ->
|
||||
val output = processOutput.stderrString
|
||||
val notInstalledRegex = Regex("""^Distribution is not installed: (.*)$""", RegexOption.MULTILINE)
|
||||
@@ -165,7 +165,7 @@ class HatchPython(runtime: HatchRuntime) : HatchCommand("python", runtime) {
|
||||
* @param dir The directory in which distributions reside
|
||||
* @return Name to Version as a map
|
||||
*/
|
||||
suspend fun show(dir: String? = null): PyExecResult<ShowResponse> {
|
||||
suspend fun show(dir: String? = null): PyResult<ShowResponse> {
|
||||
val nameToVersionRegex = """\|\s+([^|\s]+)\s+\|\s+([^|\s]+)\s+\|""".toRegex()
|
||||
fun parseNameToVersions(payload: String) = nameToVersionRegex.findAll(payload).associate {
|
||||
val (name, version) = it.destructured
|
||||
@@ -200,7 +200,7 @@ class HatchPython(runtime: HatchRuntime) : HatchCommand("python", runtime) {
|
||||
* @param names Distributions to update, you may select `all` to install all compatible distributions
|
||||
* @param dir The directory in which distributions reside
|
||||
*/
|
||||
suspend fun update(vararg names: String = ALL_NAMES, dir: String? = null): PyExecResult<PythonInstallResponse> {
|
||||
suspend fun update(vararg names: String = ALL_NAMES, dir: String? = null): PyResult<PythonInstallResponse> {
|
||||
return executeAndHandleErrors("update", *buildDirOption(dir), *names) { output ->
|
||||
Result.success(parsePythonInstallCommandOutput(output))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.python.hatch.runtime.HatchRuntime
|
||||
import com.intellij.util.Url
|
||||
import com.intellij.util.Urls
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
|
||||
/**
|
||||
* Manage environment dependencies
|
||||
@@ -17,7 +17,7 @@ class HatchSelf(runtime: HatchRuntime) : HatchCommand("self", runtime) {
|
||||
/**
|
||||
* Generate a pre-populated GitHub issue.
|
||||
*/
|
||||
suspend fun report(): PyExecResult<Url> {
|
||||
suspend fun report(): PyResult<Url> {
|
||||
return executeAndHandleErrors("report", "--no-open") { processOutput ->
|
||||
val output = processOutput.takeIf { it.exitCode == 0 }?.stdoutString?.trim()
|
||||
?: return@executeAndHandleErrors Result.failure(null)
|
||||
@@ -34,10 +34,10 @@ class HatchSelf(runtime: HatchRuntime) : HatchCommand("self", runtime) {
|
||||
/**
|
||||
* Restore the installation
|
||||
*/
|
||||
fun restore(): PyExecResult<String> = TODO()
|
||||
fun restore(): PyResult<String> = TODO()
|
||||
|
||||
/**
|
||||
* Install the latest version
|
||||
*/
|
||||
fun update(): PyExecResult<String> = TODO()
|
||||
fun update(): PyResult<String> = TODO()
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import com.intellij.python.hatch.cli.HatchCli
|
||||
import com.jetbrains.python.PythonBinary
|
||||
import com.jetbrains.python.PythonHomePath
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import com.jetbrains.python.resolvePythonBinary
|
||||
import java.nio.file.Path
|
||||
@@ -55,11 +54,11 @@ class HatchRuntime(
|
||||
* Pure execution of [hatchBinary] with command line [arguments] and [execOptions] by [execService]
|
||||
* Doesn't make any validation of stdout/stderr content.
|
||||
*/
|
||||
internal suspend fun <T> execute(vararg arguments: String, processOutputTransformer: ProcessOutputTransformer<T>): PyExecResult<T> {
|
||||
internal suspend fun <T> execute(vararg arguments: String, processOutputTransformer: ProcessOutputTransformer<T>): PyResult<T> {
|
||||
return execService.execute(hatchBinary, arguments.toList(), execOptions, processOutputTransformer = processOutputTransformer)
|
||||
}
|
||||
|
||||
internal suspend fun <T> executeInteractive(vararg arguments: String, processSemiInteractiveFun: ProcessSemiInteractiveFun<T>): PyExecResult<T> {
|
||||
internal suspend fun <T> executeInteractive(vararg arguments: String, processSemiInteractiveFun: ProcessSemiInteractiveFun<T>): PyResult<T> {
|
||||
return execService.executeAdvanced(hatchBinary, { addArgs(*arguments) }, execOptions, processSemiInteractiveHandler(code = processSemiInteractiveFun))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user