wait for task end

This commit is contained in:
jb-alvarado 2023-07-20 07:44:18 +02:00
parent 5bd1b23513
commit 52d44e7a2a
3 changed files with 17 additions and 8 deletions

8
Cargo.lock generated
View File

@ -1065,7 +1065,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout" name = "ffplayout"
version = "0.19.0" version = "0.20.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",
@ -1086,7 +1086,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-api" name = "ffplayout-api"
version = "0.19.0" version = "0.20.0"
dependencies = [ dependencies = [
"actix-files", "actix-files",
"actix-multipart", "actix-multipart",
@ -1119,7 +1119,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-lib" name = "ffplayout-lib"
version = "0.19.0" version = "0.20.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",
@ -3098,7 +3098,7 @@ dependencies = [
[[package]] [[package]]
name = "tests" name = "tests"
version = "0.19.0" version = "0.20.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",

View File

@ -3,7 +3,7 @@ members = ["ffplayout-api", "ffplayout-engine", "lib", "tests"]
default-members = ["ffplayout-api", "ffplayout-engine", "tests"] default-members = ["ffplayout-api", "ffplayout-engine", "tests"]
[workspace.package] [workspace.package]
version = "0.19.0" version = "0.20.0"
license = "GPL-3.0" license = "GPL-3.0"
repository = "https://github.com/ffplayout/ffplayout" repository = "https://github.com/ffplayout/ffplayout"
authors = ["Jonathan Baecker <jonbae77@gmail.com>"] authors = ["Jonathan Baecker <jonbae77@gmail.com>"]

View File

@ -9,7 +9,16 @@ pub fn run(config: PlayoutConfig, node: Media, server_running: bool) {
let obj = serde_json::to_string(&get_data_map(&config, node, server_running)).unwrap(); let obj = serde_json::to_string(&get_data_map(&config, node, server_running)).unwrap();
trace!("Run task: {obj}"); trace!("Run task: {obj}");
if let Err(e) = Command::new(config.task.path).arg(obj).spawn() { match Command::new(config.task.path).arg(obj).spawn() {
error!("Couldn't spawn task runner: {e}"); Ok(mut c) => {
}; let status = c.wait().expect("Error in waiting for the task process!");
if !status.success() {
error!("Process stops with error.");
}
}
Err(e) => {
error!("Couldn't spawn task runner: {e}")
}
}
} }