Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

#2342: only an explicit "wait": false skips waiting for the export

irgendwasmitfelix258699e2ab20
diff --git a/apps/filmcraft-cli/src/main.rs b/apps/filmcraft-cli/src/main.rs
index 724dfe15a..8b508e334 100644
--- a/apps/filmcraft-cli/src/main.rs
+++ b/apps/filmcraft-cli/src/main.rs
@@ -179,7 +179,10 @@ impl Backend {
if filmcraft_automation::long_job::LONG_COMMANDS.contains(&id)
&& let Some(p) = params.as_object_mut()
{
- p.entry("wait").or_insert(json!(true));
+ // anything but an explicit `false` (missing, null, a typo'd value) waits
+ if p.get("wait").and_then(Value::as_bool) != Some(false) {
+ p.insert("wait".into(), json!(true));
+ }
}
s.execute(id, params).map_err(|e| e.to_string())
}
diff --git a/apps/filmcraft-cli/tests/cli.rs b/apps/filmcraft-cli/tests/cli.rs
index 4c6d8b3ec..57db7ae47 100644
--- a/apps/filmcraft-cli/tests/cli.rs
+++ b/apps/filmcraft-cli/tests/cli.rs
@@ -156,7 +156,8 @@ fn run_waits_for_an_export_on_its_last_line() {
let dir = std::env::temp_dir().join(format!("fc-cli-run-x-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let out = dir.join("last.wav");
- let script = json!({"id": "file.exportMedia", "params": {"path": out.to_str().unwrap(), "format": "wav"}}).to_string();
+ // `"wait": null` waits too: only an explicit `false` doesn't
+ let script = json!({"id": "file.exportMedia", "params": {"path": out.to_str().unwrap(), "format": "wav", "wait": null}}).to_string();
let mut child =
Command::new(env!("CARGO_BIN_EXE_filmcraft-cli")).args(["--demo", "run", "-"]).stdin(Stdio::piped()).stdout(Stdio::piped()).spawn().unwrap();
child.stdin.take().unwrap().write_all(format!("{script}\n").as_bytes()).unwrap();