From cb5f53f0b0ebbb7dcb479c00bc30278455b7e466 Mon Sep 17 00:00:00 2001 From: Herval Freire Date: Mon, 9 Dec 2024 15:29:58 -0500 Subject: [PATCH] don't try to rm folder that doesn't exist (#2178) rm -rf returns 1 if folder doesnt exist --- .../src/main/kotlin/util/LocalSimulatorUtils.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/maestro-ios-driver/src/main/kotlin/util/LocalSimulatorUtils.kt b/maestro-ios-driver/src/main/kotlin/util/LocalSimulatorUtils.kt index 3ebcf8c91c..d2cb9a4ec0 100644 --- a/maestro-ios-driver/src/main/kotlin/util/LocalSimulatorUtils.kt +++ b/maestro-ios-driver/src/main/kotlin/util/LocalSimulatorUtils.kt @@ -391,12 +391,17 @@ object LocalSimulatorUtils { ) ) - runCommand( - listOf( - "rm", "-rf", - "$homedir/Library/Developer/CoreSimulator/Devices/$deviceId/data/Library/Keychains" + val keychainFolder = "$homedir/Library/Developer/CoreSimulator/Devices/$deviceId/data/Library/Keychains" + if (File(keychainFolder).exists()) { + runCommand( + listOf( + "rm", "-rf", + keychainFolder + ) ) - ) + } else { + logger.info("Keychain folder $keychainFolder does not exist, skipping rm") + } runCommand( listOf(