fix: Find app processes on Xcode 27 in terminateApp - #35
Conversation
|
|
| } | ||
|
|
||
| const EXECUTABLE_PATH_FILTER_FIELDS = ['ExecutablePath', 'executable.path'] as const; | ||
| const UNKNOWN_FILTER_FIELD_ERROR = /CoreDeviceError error 28001\b|Unknown filter field/; |
There was a problem hiding this comment.
checking the error message does not look like a reliable pattern to me. Can we instead verify the tool version? also the version itself could be memoized, since it's not going to change after an instance has been created
There was a problem hiding this comment.
maybe it would even be more precise to use info.jsonVersion field (in Xcode 27 it equals to 5) for this purpose rather than devicectl version.
xCode release notes for v27 ( https://developer.apple.com/documentation/xcode-release-notes/xcode-27-release-notes.md ) mentions "Fixed issues where passing a key path to a --filter flag would fail to find matches or just return an error," FB176141854/183772989
There was a problem hiding this comment.
Thanks, that is a better approach. I've switched to info.jsonVersion and dropped the error matching.
To check the threshold I ran devicectl --version and devicectl list devices --json-output for every Xcode installed on GitHub's hosted macOS runners:
| Runner | Xcode versions | devicectl version | jsonVersion |
|---|---|---|---|
| macos-14 | 15.0.1 to 16.2 | 397.28 | 2 |
| macos-15 | 16.0 to 26.3 | 506.7 | 3 |
| macos-26 | 26.0.1 to 26.6 | 518.33 | 3 |
| my Mac | 27.0 | 642.16 | 5 |
Two things I took from that:
- Everything before Xcode 27 reports 2 or 3, so
>= 5separates them cleanly. jsonVersionseems more straightforward.
terminateApp no longer tries ExecutablePath and falls back to executable.path when devicectl rejects it with error 28001. It reads info.jsonVersion once per instance and filters on ExecutablePath from version 5 (Xcode 27), and on executable.path before that. Xcode 15.0 through 26.6 on GitHub's macOS runners report JSON version 2 or 3; Xcode 27.0 reports 5.
## [2.1.1](v2.1.0...v2.1.1) (2026-10-02) ### Bug Fixes * Find app processes on Xcode 27 in terminateApp ([#35](#35)) ([7b7befa](7b7befa))
|
🎉 This PR is included in version 2.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
On Xcode 27, devicectl no longer accepts executable.path as a process filter, so terminateApp fails straight away:
ERROR: Unknown filter field 'executable.path'. Did you mean 'Executable Path'? (com.apple.dt.CoreDeviceError error 28001)Written as one word, ExecutablePath works on Xcode 27. This reads
info.jsonVersionfrom devicectl once per instance and filters on ExecutablePath when it is 5 or higher, and on executable.path otherwise.Xcode 15.0 through 26.6 on GitHub's macOS runners report JSON version 2 or 3; Xcode 27.0 reports 5.
Tested on Xcode 27.0 with a physical iPhone: terminateApp returns true for a running app and false once it is closed. The path for older Xcode is covered by unit tests only because I no longer have Xcode 26.