Skip to content

Commit 0ac3449

Browse files
committed
chore: fix simulator autodetect awk
Signed-off-by: William Richter <[email protected]>
1 parent d34c05f commit 0ac3449

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/test-matrix.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ pick_latest_iphone_name() {
3535
pick_device_udid_by_name() {
3636
local name="$1"
3737
# Extract the first UDID for a device line containing the provided name
38-
xcrun simctl list devices 2>/dev/null | awk -v n="$name" 'index($0,n)>0 { if (match($0, /\(([A-F0-9-]{36})\)/, m)) { print m[1]; exit } }'
38+
xcrun simctl list devices 2>/dev/null | awk -F '[()]' -v n="$name" '
39+
index($0, n) > 0 {
40+
for (i = 1; i <= NF; i++) {
41+
if ($i ~ /^[A-F0-9-]{36}$/) {
42+
print $i
43+
exit
44+
}
45+
}
46+
}
47+
'
3948
}
4049

4150
# If destination is a placeholder, pick a concrete available simulator (prefer newest iPhone)

0 commit comments

Comments
 (0)