@@ -65,7 +65,7 @@ async function stopRunnerRecordingBestEffort(params: {
6565 device : SessionState [ 'device' ] ;
6666 logPath ?: string ;
6767 deps : RecordTraceDeps ;
68- } ) : Promise < void > {
68+ } ) : Promise < boolean > {
6969 const { req, activeSession, device, logPath, deps } = params ;
7070 const appBundleId = normalizeAppBundleId ( activeSession ) ;
7171
@@ -75,6 +75,7 @@ async function stopRunnerRecordingBestEffort(params: {
7575 { command : 'recordStop' , appBundleId } ,
7676 getIosRunnerOptions ( req , logPath , activeSession ) ,
7777 ) ;
78+ return true ;
7879 } catch ( error ) {
7980 emitDiagnostic ( {
8081 level : 'warn' ,
@@ -87,6 +88,7 @@ async function stopRunnerRecordingBestEffort(params: {
8788 error : formatRecordTraceError ( error ) ,
8889 } ,
8990 } ) ;
91+ return false ;
9092 }
9193}
9294
@@ -318,7 +320,13 @@ export async function stopIosDeviceRecording(params: {
318320 recording : Extract < NonNullable < SessionState [ 'recording' ] > , { platform : 'ios-device-runner' } > ;
319321} ) : Promise < DaemonResponse | null > {
320322 const { req, activeSession, device, logPath, deps, recording } = params ;
321- await stopRunnerRecordingBestEffort ( { req, activeSession, device, logPath, deps } ) ;
323+ const runnerStopOk = await stopRunnerRecordingBestEffort ( {
324+ req,
325+ activeSession,
326+ device,
327+ logPath,
328+ deps,
329+ } ) ;
322330
323331 let copyResult = { stdout : '' , stderr : '' , exitCode : 1 } ;
324332 for ( const bundleId of IOS_RUNNER_CONTAINER_BUNDLE_IDS ) {
@@ -363,6 +371,12 @@ export async function stopIosDeviceRecording(params: {
363371 `failed to stop recording: ${ recording . outPath } was not finalized into a playable video` ,
364372 ) ;
365373 }
374+ if ( ! runnerStopOk ) {
375+ return errorResponse (
376+ 'COMMAND_FAILED' ,
377+ 'failed to stop recording: the iOS runner reported recordStop did not succeed' ,
378+ ) ;
379+ }
366380
367381 const trimStartMs = resolveIosRecordingTrimStartMs ( recording ) ;
368382 if ( trimStartMs > 0 ) {
0 commit comments