|
| 1 | +SPAWNER |
| 2 | +======= |
| 3 | + |
| 4 | +This is a very simple tool, which executes another process, disclaiming any |
| 5 | +responsibility for it. |
| 6 | + |
| 7 | +This is important when executing tests apps, because when macOS sees that an |
| 8 | +app uses API that needs specific entries in the Info.plist (such as the |
| 9 | +`NSAppleMusicUsageDescription`), the responsible process is where macOS looks |
| 10 | +for said key. |
| 11 | + |
| 12 | +Example crash report: |
| 13 | + |
| 14 | +``` |
| 15 | +Process: introspection [85822] |
| 16 | +Path: /Users/USER/*/introspection.app/Contents/MacOS/introspection |
| 17 | +Identifier: com.xamarin.introspection |
| 18 | +Version: 1.0 (1.0) |
| 19 | +Code Type: ARM-64 (Native) |
| 20 | +Parent Process: dotnet [81129] |
| 21 | +Responsible: Electron [68966] |
| 22 | +User ID: 501 |
| 23 | +
|
| 24 | +Date/Time: 2025-11-13 17:33:10.8123 +0100 |
| 25 | +OS Version: macOS 15.7.2 (24G325) |
| 26 | +Report Version: 12 |
| 27 | +Anonymous UUID: F22C0F06-0F16-E475-C0CB-264A0FF4F6A3 |
| 28 | +
|
| 29 | +
|
| 30 | +Time Awake Since Boot: 27000 seconds |
| 31 | +
|
| 32 | +System Integrity Protection: enabled |
| 33 | +
|
| 34 | +Crashed Thread: 16 Dispatch queue: com.apple.root.default-qos |
| 35 | +
|
| 36 | +Exception Type: EXC_CRASH (SIGKILL) |
| 37 | +Exception Codes: 0x0000000000000000, 0x0000000000000000 |
| 38 | +
|
| 39 | +Termination Reason: Namespace TCC, Code 0 |
| 40 | +This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSAppleMusicUsageDescription key with a string value explaining to the user how the app uses this data. |
| 41 | +``` |
| 42 | + |
| 43 | +The app crashed because macOS says it needs the `NSAppleMusicUsageDescription` entry in its `Info.plist` file. |
| 44 | + |
| 45 | +This is confusing, because introspection has an `NSAppleMusicUsageDescription` entry in its `Info.plist` file. |
| 46 | + |
| 47 | +Here's what happens: |
| 48 | + |
| 49 | +Note that there's a "Responsible [Process]" (Electron 68966) line, which is not the same as "Process" (introspection 85822), and this is the crux of the matter. |
| 50 | + |
| 51 | +In this particular case: |
| 52 | + |
| 53 | +* I opened the xharness project in VSCode. |
| 54 | +* I launched the xharness project in the debugger, and then ran introspection for Mac Catalyst. |
| 55 | +* The responsible process ended up being VS Code (aka Electron, with pid 85822), and that's where macOS ended up looking for the `NSAppleMusicUsageDescription` key. |
| 56 | + |
| 57 | +The fix is to launch `introspection` (and any other test app on macOS) using |
| 58 | +this `spawner` tool, which disclaims reponsibility for anything it launches, |
| 59 | +thus letting `introspection` be a grown up process and fully responsible for |
| 60 | +itself. |
| 61 | + |
| 62 | +Usage is simple: just pass the executable + any arguments to `spawner`. |
| 63 | + |
| 64 | +References: |
| 65 | + |
| 66 | +* https://gitlab.com/gnachman/iterm2/-/issues/10360 |
| 67 | +* https://github.com/llvm/llvm-project/commit/041c7b84a4b925476d1e21ed302786033bb6035f#diff-a38ae411ccf0c85f3d7c0c45d8e1ad035030d5171d59e478b86a094941d3209dR16-R17 |
| 68 | +* https://lldb.llvm.org/cpp_reference/PosixSpawnResponsible_8h_source.html |
| 69 | +* https://steipete.me/posts/2025/applescript-cli-macos-complete-guide |
0 commit comments