diff --git a/Makefile b/Makefile index 9c08a8b..82a50b7 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ build-rs: if [ $(BUILD_GUI) -eq 1 ]; then \ $(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth -p gpgui-helper; \ else \ - $(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth; \ + $(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth --no-default-features; \ fi clean: diff --git a/README.md b/README.md index 9bef41c..f1053a5 100644 --- a/README.md +++ b/README.md @@ -288,13 +288,16 @@ This project includes a DevContainer configuration that provides a consistent, r ``` 3. **Build the project:** + + To build everything including the GUI helper run this command: ```bash docker run --privileged --cap-add=NET_ADMIN --device=/dev/net/tun \ - -v "$(pwd)":/workspace -w /workspace gpoc-devcontainer \ + --tty -v "$(pwd)":/workspace -w /workspace gpoc-devcontainer \ bash -c "export PATH=/usr/local/cargo/bin:\$PATH && make build" ``` + To build without the GUI helper run the same command as above, but with `BUILD_GUI=0` passed as an argument to `make`. -4. **Locate build artifacts:** +5. **Locate build artifacts:** The compiled binaries will be available in `target/release/`: - `gpclient` – CLI client diff --git a/crates/gpapi/src/process/auth_launcher.rs b/crates/gpapi/src/process/auth_launcher.rs index c67f939..ab80bdc 100644 --- a/crates/gpapi/src/process/auth_launcher.rs +++ b/crates/gpapi/src/process/auth_launcher.rs @@ -177,12 +177,16 @@ impl<'a> SamlAuthLauncher<'a> { } let mut non_root_cmd = auth_cmd.into_non_root()?; - let output = non_root_cmd - .kill_on_drop(true) - .stdout(Stdio::piped()) - .spawn()? - .wait_with_output() - .await?; + let child = non_root_cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn(); + + let child = match child { + Ok(child) => child, + Err(err) => { + bail!("Failed to spawn {}: {}", program, err); + } + }; + + let output = child.wait_with_output().await?; let Ok(auth_result) = serde_json::from_slice::(&output.stdout) else { bail!("Failed to parse auth data") diff --git a/crates/gpapi/src/process/gui_helper_launcher.rs b/crates/gpapi/src/process/gui_helper_launcher.rs index f56a65e..b0b88b0 100644 --- a/crates/gpapi/src/process/gui_helper_launcher.rs +++ b/crates/gpapi/src/process/gui_helper_launcher.rs @@ -50,7 +50,12 @@ impl<'a> GuiHelperLauncher<'a> { info!("Launching gpgui-helper"); let mut non_root_cmd = cmd.into_non_root()?; - let mut child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn()?; + let child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn(); + let mut child = match child { + Ok(child) => child, + Err(err) => bail!("Failed to spawn {}: {}", self.program.display(), err), + }; + let Some(mut stdin) = child.stdin.take() else { bail!("Failed to open stdin"); }; diff --git a/crates/gpapi/src/process/gui_launcher.rs b/crates/gpapi/src/process/gui_launcher.rs index 3658874..bf0161e 100644 --- a/crates/gpapi/src/process/gui_launcher.rs +++ b/crates/gpapi/src/process/gui_launcher.rs @@ -69,7 +69,12 @@ impl<'a> GuiLauncher<'a> { info!("Launching gpgui"); let mut non_root_cmd = cmd.into_non_root()?; - let mut child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn()?; + let child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn(); + let mut child = match child { + Ok(child) => child, + Err(err) => bail!("Failed to spawn {}: {}", self.program.display(), err), + }; + let Some(mut stdin) = child.stdin.take() else { bail!("Failed to open stdin"); }; diff --git a/crates/gpapi/src/process/hip_launcher.rs b/crates/gpapi/src/process/hip_launcher.rs index 02ba227..42f6336 100644 --- a/crates/gpapi/src/process/hip_launcher.rs +++ b/crates/gpapi/src/process/hip_launcher.rs @@ -72,12 +72,14 @@ impl<'a> HipLauncher<'a> { cmd.env("APP_VERSION", client_version); } - let output = cmd - .kill_on_drop(true) - .stdout(Stdio::piped()) - .spawn()? - .wait_with_output() - .await?; + let child = cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn(); + + let child = match child { + Ok(child) => child, + Err(err) => bail!("Failed to spawn {}: {}", self.program, err), + }; + + let output = child.wait_with_output().await?; if let Some(exit_status) = output.status.code() { if exit_status != 0 {