mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Python: make runExecutable interface return the only error it can return
GitOrigin-RevId: 30f11900a7bf1085c405d92e6f58f771ed1c9004
This commit is contained in:
committed by
intellij-monorepo-bot
parent
10a99cfa8e
commit
43618513c0
@@ -8,6 +8,10 @@ import com.jetbrains.python.packaging.PyExecutionException
|
||||
* Use it instead of exceptions and Kotlin Result.
|
||||
*/
|
||||
typealias PyResult<T> = com.jetbrains.python.Result<T, PyError>
|
||||
/**
|
||||
* Like [PyResult] but error is always [ExecError]
|
||||
*/
|
||||
typealias PyExecResult<T> = com.jetbrains.python.Result<T, ExecError>
|
||||
|
||||
inline fun <reified T : PyError> failure(pyError: T): com.jetbrains.python.Result.Failure<T> = com.jetbrains.python.Result.Companion.failure(pyError)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.jetbrains.python.sdk
|
||||
import com.intellij.python.community.execService.ExecOptions
|
||||
import com.intellij.python.community.execService.ExecService
|
||||
import com.intellij.python.community.execService.WhatToExec
|
||||
import com.jetbrains.python.errorProcessing.PyResult
|
||||
import com.jetbrains.python.errorProcessing.PyExecResult
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
import java.nio.file.Path
|
||||
|
||||
@@ -17,5 +17,5 @@ import java.nio.file.Path
|
||||
* @return A [Result] object containing the output of the command execution.
|
||||
*/
|
||||
@Internal
|
||||
suspend fun runExecutable(executable: Path, projectPath: Path?, vararg args: String): PyResult<String> =
|
||||
suspend fun runExecutable(executable: Path, projectPath: Path?, vararg args: String): PyExecResult<String> =
|
||||
ExecService().execGetStdout(WhatToExec.Binary(executable), args.toList(), ExecOptions(workingDirectory = projectPath))
|
||||
Reference in New Issue
Block a user