@@ -56,50 +56,24 @@ async function runSimctlCommand(
5656 return await runCommand ( 'xcrun' , [ ...simctlCommand ( args ) ] , options ) ;
5757}
5858
59- /**
60- * simctl's own error-protocol header, printed once at the top of stderr ahead of the human
61- * sentence it renders: `An error was encountered processing the command (domain=…, code=…):`.
62- * The header line is the protocol; the text after it is CoreSimulator's prose. A nested
63- * `Underlying error (…)` line is indented and is never this line.
64- */
59+ /** The first unindented simctl error header; diagnostic lines can precede it on stderr. */
6560const SIMCTL_ERROR_HEADER =
66- / ^ A n e r r o r w a s e n c o u n t e r e d p r o c e s s i n g t h e c o m m a n d \( d o m a i n = ( [ ^ , ] + ) , c o d e = ( - ? \d + ) \) : [ \t ] * (?: \r ? \n | $ ) / ;
61+ / ^ A n e r r o r w a s e n c o u n t e r e d p r o c e s s i n g t h e c o m m a n d \( d o m a i n = ( [ ^ , ] + ) , c o d e = ( - ? \d + ) \) : [ \t ] * (?: \r ? \n | $ ) / m ;
6762
68- /**
69- * `NSPOSIXErrorDomain` code 60 is macOS `ETIMEDOUT`: the tool's own answer that the screenshot
70- * call timed out. This is the only place that reads it, so the verdict becomes a typed reason here
71- * and nothing downstream re-parses the tool's text. A nested `Underlying error (…)` line is
72- * indented and is never the header, and a code the header does not state is not this reason.
73- */
63+ /** macOS ETIMEDOUT in simctl's protocol, classified only by this local adapter. */
7464const SIMCTL_SCREENSHOT_TIMEOUT_DOMAIN = 'NSPOSIXErrorDomain' ;
7565const SIMCTL_SCREENSHOT_TIMEOUT_CODE = 60 ;
7666
77- /**
78- * `details.reason` this adapter stamps when simctl's screenshot call reports its own protocol
79- * timeout. Owned beside the parse that mints it; the screenshot retry and runner-fallback decisions
80- * read the reason and never the tool's wording.
81- */
67+ /** The local screenshot timeout reason consumed by retry and runner fallback. */
8268export const SIMCTL_SCREENSHOT_TIMEOUT_REASON = 'simulator-screenshot-timeout' ;
8369
84- /**
85- * The screenshot subcommand of an otherwise-unscoped simctl argv: `io <udid> screenshot …`. The
86- * `--set <path>` prefix is stripped first, and the flag fragments simctl's screenshot options add
87- * (`--mask=`, `--display=`) come after the subcommand, so positions 0 and 2 are the verb pair.
88- */
70+ /** Screenshot options follow `io <udid> screenshot`; a simulator-set prefix precedes it. */
8971function isSimctlScreenshotArgs ( args : ScopedSimctlArgs ) : boolean {
9072 const unscoped = args [ 0 ] === '--set' ? args . slice ( 2 ) : args ;
9173 return unscoped [ 0 ] === 'io' && unscoped [ 2 ] === 'screenshot' ;
9274}
9375
94- /**
95- * The local simctl adapter: the one producer that runs `xcrun simctl` itself, so the one place
96- * allowed to read the tool's error protocol. A failed screenshot call answers with the typed
97- * {@link SIMCTL_SCREENSHOT_TIMEOUT_CODE} reason and keeps every exit-failure detail the exec layer
98- * would have produced; other failures, and other subcommands, keep exec's own behaviour.
99- *
100- * `reason` is stamped, never host-kit's `timeoutMs`: that field is exec's evidence that *it* killed
101- * a child at its deadline, and `isCommandTimeoutError` reads it as such.
102- */
76+ /** Stamp {@link SIMCTL_SCREENSHOT_TIMEOUT_REASON}, preserving exec's own timeout evidence. */
10377async function runLocalSimctlCommand (
10478 args : ScopedSimctlArgs ,
10579 options ?: AppleToolExecOptions ,
0 commit comments