Skip to content

Commit cdff2c6

Browse files
committed
Remove setsid and timeout from child processes
1 parent da50fdd commit cdff2c6

File tree

5 files changed

+2
-37
lines changed

5 files changed

+2
-37
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ filetime = "0.2"
3838
flat-manager-common = { path = "common" }
3939
hex = "0.4"
4040
jwt = { package = "jsonwebtoken", version = "10.3.0", features = ["aws_lc_rs"] }
41-
libc = "0.2"
4241
log = "0.4"
4342
libostree = { package = "ostree", version = "0.20.5", features = ["v2021_5"] }
4443
r2d2 = "0.8"

src/jobs/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ mod update_repo_job;
1414
pub use check_job::update_build_status_after_check;
1515
pub use job_executor::start_job_executor;
1616
pub use job_queue::{cleanup_started_jobs, JobQueue, ProcessJobs, StopJobQueue};
17-
pub(crate) use utils::SetsidCommandExt;
1817

1918
/**************************************************************************
2019
* Job handling - theory of operations.

src/jobs/utils.rs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use diesel::prelude::*;
33
use diesel::result::Error as DieselError;
44
use log::{error, info};
55
use std::fmt::Write as _;
6-
use std::os::unix::process::CommandExt as _;
76
use std::process::{Command, Output, Stdio};
87
use std::str;
98

@@ -14,34 +13,6 @@ use crate::schema::*;
1413

1514
use super::job_queue::queue_update_job;
1615

17-
pub trait SetsidCommandExt {
18-
fn setsid(&mut self) -> &mut Self;
19-
}
20-
21-
impl SetsidCommandExt for Command {
22-
fn setsid(&mut self) -> &mut Self {
23-
unsafe {
24-
self.pre_exec(|| {
25-
libc::setsid();
26-
Ok(())
27-
});
28-
}
29-
self
30-
}
31-
}
32-
33-
impl SetsidCommandExt for tokio::process::Command {
34-
fn setsid(&mut self) -> &mut Self {
35-
unsafe {
36-
self.pre_exec(|| {
37-
libc::setsid();
38-
Ok(())
39-
});
40-
}
41-
self
42-
}
43-
}
44-
4516
pub fn generate_flatpakref(
4617
ref_name: &str,
4718
maybe_build_id: Option<i32>,
@@ -161,7 +132,7 @@ macro_rules! job_log_and_error {
161132
/// Executes a command and returns its output. A JobError is returned if the command couldn't be executed, but not if
162133
/// it exits with a status code.
163134
pub fn do_command_with_output(cmd: &mut Command) -> JobResult<Output> {
164-
let output = SetsidCommandExt::setsid(cmd)
135+
let output = cmd
165136
.stdin(Stdio::null())
166137
.stdout(Stdio::piped())
167138
.stderr(Stdio::piped())

src/ostree.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ pub use flat_manager_common::ostree::*;
33
use std::path::Path;
44
use tokio::process::Command;
55

6-
use crate::jobs::SetsidCommandExt;
76
pub async fn generate_delta_async(repo_path: &Path, delta: &Delta) -> Result<(), OstreeError> {
8-
let mut cmd = Command::new("timeout");
9-
cmd.arg("3600").arg("flatpak");
10-
SetsidCommandExt::setsid(&mut cmd);
7+
let mut cmd = Command::new("flatpak");
118

129
cmd.arg("build-update-repo")
1310
.arg("--generate-static-delta-to")

0 commit comments

Comments
 (0)