diff --git a/python/python-hatch/src/com/intellij/python/hatch/cli/HatchCli.kt b/python/python-hatch/src/com/intellij/python/hatch/cli/HatchCli.kt index aba777c9cb78..0e97b098305c 100644 --- a/python/python-hatch/src/com/intellij/python/hatch/cli/HatchCli.kt +++ b/python/python-hatch/src/com/intellij/python/hatch/cli/HatchCli.kt @@ -15,6 +15,7 @@ import com.jetbrains.python.errorProcessing.PyResult import io.github.z4kn4fein.semver.Version import io.github.z4kn4fein.semver.VersionFormatException import java.io.IOException +import java.nio.file.InvalidPathException import java.nio.file.Path /** @@ -189,7 +190,7 @@ class HatchCli(private val runtime: HatchRuntime) { try { Result.success(HatchStatus(project, Path.of(location), Path.of(config))) } - catch (e: Exception) { + catch (e: InvalidPathException) { Result.failure(e.localizedMessage) } } @@ -224,7 +225,7 @@ class HatchCli(private val runtime: HatchRuntime) { * @return OldVersion to NewVersion as Pair */ suspend fun setVersion(desiredVersion: String): PyResult> { - val expectedOutput = """^Old: (.*)\nNew: (.*)\n$""".toRegex() + val expectedOutput = """^(?:.*\n)*Old: (.*)\nNew: (.*)\n?$""".toRegex() return runtime.executeAndMatch("version", desiredVersion, expectedOutput = expectedOutput, outputContentSupplier = { it.stderrString }) { matchResult -> val (oldVersion, newVersion) = matchResult.destructured diff --git a/python/python-hatch/src/com/intellij/python/hatch/cli/HatchEnv.kt b/python/python-hatch/src/com/intellij/python/hatch/cli/HatchEnv.kt index 0da9fcc79b37..2b1fc5245ee7 100644 --- a/python/python-hatch/src/com/intellij/python/hatch/cli/HatchEnv.kt +++ b/python/python-hatch/src/com/intellij/python/hatch/cli/HatchEnv.kt @@ -116,7 +116,7 @@ const val ENV_TYPE_VIRTUAL: String = "virtual" */ class HatchEnv(runtime: HatchRuntime) : HatchCommand("env", runtime) { companion object { - private val SHOW_RESPONSE_REGEX = """^\s+Standalone\s*\n((?:[+|].*[+|]\n)+)(?:\s+Matrices\s*\n((?:[+|].*[+|]\n)+))?$""".toRegex() + private val SHOW_RESPONSE_REGEX = """^\s*Standalone\s*\n((?:[+|].*[+|]\n)+)(?:\s+Matrices\s*\n((?:[+|].*[+|]\n)+))?$""".toRegex() } enum class CreateResult {