Skip to content

Commit fa278cf

Browse files
authored
Analytics: fix crash when flutter|xcodebuild is not installed (#1839)
* Analytics: fix crash when flutter|xcodebuild is not installed * bump version to v1.37.1
1 parent 546198b commit fa278cf

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ android.useAndroidX=true
22
android.enableJetifier=true
33
kotlin.code.style=official
44
GROUP=dev.mobile
5-
VERSION_NAME=1.37.0
5+
VERSION_NAME=1.37.1
66
POM_DESCRIPTION=Maestro is a server-driven platform-agnostic library that allows to drive tests for both iOS and Android using the same implementation through an intuitive API.
77
POM_URL=https://github.com/mobile-dev-inc/maestro
88
POM_SCM_URL=https://github.com/mobile-dev-inc/maestro
@@ -14,4 +14,4 @@ POM_LICENCE_DIST=repo
1414
POM_DEVELOPER_ID=mobile-dev-inc
1515
POM_DEVELOPER_NAME=mobile.dev inc.
1616
SONATYPE_STAGING_PROFILE=dev.mobile
17-
org.gradle.jvmargs=-Xmx2000m
17+
org.gradle.jvmargs=-Xmx2000m

maestro-cli/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CLI_VERSION=1.37.0
1+
CLI_VERSION=1.37.1

maestro-cli/src/main/java/maestro/cli/util/EnvUtils.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import maestro.cli.api.CliVersion
66
import maestro.cli.update.Updates
77
import maestro.cli.view.red
88
import java.io.File
9+
import java.io.IOException
910
import java.nio.file.Path
1011
import java.nio.file.Paths
1112
import java.util.Properties
@@ -89,10 +90,15 @@ object EnvUtils {
8990
}
9091

9192
fun getFlutterVersionAndChannel(): Pair<String?, String?> {
92-
val stdout = runProcess(
93-
"flutter",
94-
"--no-version-check", "--version", "--machine",
95-
).joinToString(separator = "")
93+
val stdout = try {
94+
runProcess(
95+
"flutter",
96+
"--no-version-check", "--version", "--machine",
97+
).joinToString(separator = "")
98+
} catch (e: IOException) {
99+
// Flutter is probably not installed
100+
return Pair(first = null, second = null)
101+
}
96102

97103
val mapper = jacksonObjectMapper()
98104
val version = runCatching {

maestro-cli/src/main/java/maestro/cli/util/IOSEnvUtils.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package maestro.cli.util
22

3+
import java.io.IOException
34
import kotlin.io.path.Path
45

56
object IOSEnvUtils {
@@ -23,7 +24,12 @@ object IOSEnvUtils {
2324

2425
val xcodeVersion: String?
2526
get() {
26-
val lines = runProcess("xcodebuild", "-version")
27+
val lines = try {
28+
runProcess("xcodebuild", "-version")
29+
} catch (e: IOException) {
30+
// Xcode toolchain is probably not installed
31+
return null
32+
}
2733

2834
if (lines.size == 2 && lines.first().contains(' ')) {
2935
// Correct xcodebuild invocation is always 2 lines. Example:

0 commit comments

Comments
 (0)