Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(cli): validate project before treating dead session as stopped
Richie McIlroy70f558999d42
diff --git a/apps/cli/src/record.rs b/apps/cli/src/record.rsindex 473b22907..4509505d8 100644--- a/apps/cli/src/record.rs+++ b/apps/cli/src/record.rs@@ -530,21 +530,26 @@ impl RecordStopArgs {}if !session::process_alive(current.pid) {- // The worker died without flipping its status. Trust the on-disk recording-meta.json- // as the source of truth for whether the .cap finalized.let recording_meta_exists = current.path.join("recording-meta.json").exists();+ if !recording_meta_exists {+ return fail_dead_session(+ current,+ "recording process exited without finalizing the recording".to_string(),+ );+ }++ if let Err(error) = crate::project::validate_project(¤t.path) {+ return fail_dead_session(current, error);+ }+session::cleanup(&id);- return if recording_meta_exists {- emit_record_event(- format,- &RecordEvent::Stopped {- path: ¤t.path.display().to_string(),- recording_meta_exists: true,- },- )- } else {- Err("recording process exited without finalizing the recording".to_string())- };+ return emit_record_event(+ format,+ &RecordEvent::Stopped {+ path: ¤t.path.display().to_string(),+ recording_meta_exists: true,+ },+ );}if Instant::now() >= deadline {@@ -559,6 +564,15 @@ impl RecordStopArgs {}}+fn fail_dead_session(session: Session, error: String) -> Result<(), String> {+ let _ = session::write_session(&Session {+ status: SessionStatus::Error,+ error: Some(error.clone()),+ ..session+ });+ Err(error)+}+fn resolve_session(id: Option<&str>, path: Option<&Path>) -> Result<Session, String> {if let Some(id) = id {return session::read_session(id);