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

View File

@ -3,7 +3,7 @@ members = ["ffplayout-api", "ffplayout-engine", "lib", "tests"]
default-members = ["ffplayout-api", "ffplayout-engine", "tests"]
[workspace.package]
version = "0.19.0"
version = "0.20.0"
license = "GPL-3.0"
repository = "https://github.com/ffplayout/ffplayout"
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();
trace!("Run task: {obj}");
if let Err(e) = Command::new(config.task.path).arg(obj).spawn() {
error!("Couldn't spawn task runner: {e}");
};
match Command::new(config.task.path).arg(obj).spawn() {
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}")
}
}
}