Skip to content

Commit

Permalink
ostree: Use new pre_exec instead of deprectated before_exec
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlarsson committed Oct 22, 2019
1 parent f52f287 commit 7fd8e5b
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions src/ostree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,16 @@ pub fn pull_commit_async(n_retries: i32,
commit: String) -> Box<dyn Future<Item=(), Error=OstreeError>> {
Box::new(future::loop_fn(n_retries, move |count| {
let mut cmd = Command::new("ostree");
cmd
.before_exec (|| {
// Setsid in the child to avoid SIGINT on server killing
// child and breaking the graceful shutdown
unsafe { libc::setsid() };
Ok(())
});
unsafe {
cmd
.pre_exec (|| {
// Setsid in the child to avoid SIGINT on server killing
// child and breaking the graceful shutdown
libc::setsid();
Ok(())
});
}

cmd
.arg(&format!("--repo={}", &repo_path.to_str().unwrap()))
.arg("pull")
Expand Down Expand Up @@ -506,13 +509,15 @@ pub fn generate_delta_async(repo_path: &PathBuf,
delta: &Delta) -> Box<dyn Future<Item=(), Error=OstreeError>> {
let mut cmd = Command::new("flatpak");

cmd
.before_exec (|| {
// Setsid in the child to avoid SIGINT on server killing
// child and breaking the graceful shutdown
unsafe { libc::setsid() };
Ok(())
});
unsafe {
cmd
.pre_exec (|| {
// Setsid in the child to avoid SIGINT on server killing
// child and breaking the graceful shutdown
libc::setsid();
Ok(())
});
}

cmd
.arg("build-update-repo")
Expand Down Expand Up @@ -540,13 +545,15 @@ pub fn generate_delta_async(repo_path: &PathBuf,
pub fn prune_async(repo_path: &PathBuf) -> Box<dyn Future<Item=(), Error=OstreeError>> {
let mut cmd = Command::new("ostree");

cmd
.before_exec (|| {
// Setsid in the child to avoid SIGINT on server killing
// child and breaking the graceful shutdown
unsafe { libc::setsid() };
Ok(())
});
unsafe {
cmd
.pre_exec (|| {
// Setsid in the child to avoid SIGINT on server killing
// child and breaking the graceful shutdown
libc::setsid();
Ok(())
});
}

cmd
.arg("prune")
Expand Down

0 comments on commit 7fd8e5b

Please sign in to comment.