From 8287a669fb43e24434cc6927aa1fdf268dd46a53 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Wed, 15 Apr 2026 23:37:29 +0100 Subject: [PATCH 1/4] fix: builds with `BUILD_GUI=0` now omit the `webview-auth` feature --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 65a93041aa7830e53f95786faa0d18bc410aacac Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Wed, 15 Apr 2026 23:39:47 +0100 Subject: [PATCH 2/4] fix: mention the `BUILD_GUI` option in the docs --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 From e4426df6a20de4ff73e6f4503fe3a222d7527326 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Thu, 16 Apr 2026 00:17:59 +0100 Subject: [PATCH 3/4] fix: better error messages when spawning a child program fails --- crates/gpapi/src/process/auth_launcher.rs | 10 ++++++++-- crates/gpapi/src/process/gui_helper_launcher.rs | 6 +++++- crates/gpapi/src/process/gui_launcher.rs | 6 +++++- crates/gpapi/src/process/hip_launcher.rs | 10 ++++++++-- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/crates/gpapi/src/process/auth_launcher.rs b/crates/gpapi/src/process/auth_launcher.rs index c67f939..053c033 100644 --- a/crates/gpapi/src/process/auth_launcher.rs +++ b/crates/gpapi/src/process/auth_launcher.rs @@ -177,10 +177,16 @@ impl<'a> SamlAuthLauncher<'a> { } let mut non_root_cmd = auth_cmd.into_non_root()?; - let output = non_root_cmd + let child = non_root_cmd .kill_on_drop(true) .stdout(Stdio::piped()) - .spawn()? + .spawn(); + + if child.is_err() { + bail!("Failed to spawn {}: {}", program, child.unwrap_err()) + } + + let output = child.unwrap() .wait_with_output() .await?; diff --git a/crates/gpapi/src/process/gui_helper_launcher.rs b/crates/gpapi/src/process/gui_helper_launcher.rs index f56a65e..5de0f76 100644 --- a/crates/gpapi/src/process/gui_helper_launcher.rs +++ b/crates/gpapi/src/process/gui_helper_launcher.rs @@ -50,7 +50,11 @@ 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 result = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn(); + if result.is_err() { + bail!("Failed to spawn {}: {}", self.program.display(), result.unwrap_err()) + } + let mut child = result.unwrap(); 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..ecbd97e 100644 --- a/crates/gpapi/src/process/gui_launcher.rs +++ b/crates/gpapi/src/process/gui_launcher.rs @@ -69,7 +69,11 @@ 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 result = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn(); + if result.is_err() { + bail!("Failed to spawn {}: {}", self.program.display(), result.unwrap_err()) + } + let mut child = result.unwrap(); 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..33db329 100644 --- a/crates/gpapi/src/process/hip_launcher.rs +++ b/crates/gpapi/src/process/hip_launcher.rs @@ -72,10 +72,16 @@ impl<'a> HipLauncher<'a> { cmd.env("APP_VERSION", client_version); } - let output = cmd + let child = cmd .kill_on_drop(true) .stdout(Stdio::piped()) - .spawn()? + .spawn(); + + if child.is_err() { + bail!("Failed to spawn {}: {}", self.program, child.unwrap_err()) + } + + let output = child.unwrap() .wait_with_output() .await?; From e4295a6ce8ac1be56255adb13ff83920bf7c2131 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Thu, 16 Apr 2026 22:30:08 +0800 Subject: [PATCH 4/4] fix: improve error handling when spawning child processes --- crates/gpapi/src/process/auth_launcher.rs | 18 ++++++++---------- .../gpapi/src/process/gui_helper_launcher.rs | 11 ++++++----- crates/gpapi/src/process/gui_launcher.rs | 11 ++++++----- crates/gpapi/src/process/hip_launcher.rs | 16 ++++++---------- 4 files changed, 26 insertions(+), 30 deletions(-) diff --git a/crates/gpapi/src/process/auth_launcher.rs b/crates/gpapi/src/process/auth_launcher.rs index 053c033..ab80bdc 100644 --- a/crates/gpapi/src/process/auth_launcher.rs +++ b/crates/gpapi/src/process/auth_launcher.rs @@ -177,18 +177,16 @@ impl<'a> SamlAuthLauncher<'a> { } let mut non_root_cmd = auth_cmd.into_non_root()?; - let child = non_root_cmd - .kill_on_drop(true) - .stdout(Stdio::piped()) - .spawn(); + let child = non_root_cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn(); - if child.is_err() { - bail!("Failed to spawn {}: {}", program, child.unwrap_err()) - } + let child = match child { + Ok(child) => child, + Err(err) => { + bail!("Failed to spawn {}: {}", program, err); + } + }; - let output = child.unwrap() - .wait_with_output() - .await?; + 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 5de0f76..b0b88b0 100644 --- a/crates/gpapi/src/process/gui_helper_launcher.rs +++ b/crates/gpapi/src/process/gui_helper_launcher.rs @@ -50,11 +50,12 @@ impl<'a> GuiHelperLauncher<'a> { info!("Launching gpgui-helper"); let mut non_root_cmd = cmd.into_non_root()?; - let result = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn(); - if result.is_err() { - bail!("Failed to spawn {}: {}", self.program.display(), result.unwrap_err()) - } - let mut child = result.unwrap(); + 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 ecbd97e..bf0161e 100644 --- a/crates/gpapi/src/process/gui_launcher.rs +++ b/crates/gpapi/src/process/gui_launcher.rs @@ -69,11 +69,12 @@ impl<'a> GuiLauncher<'a> { info!("Launching gpgui"); let mut non_root_cmd = cmd.into_non_root()?; - let result = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn(); - if result.is_err() { - bail!("Failed to spawn {}: {}", self.program.display(), result.unwrap_err()) - } - let mut child = result.unwrap(); + 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 33db329..42f6336 100644 --- a/crates/gpapi/src/process/hip_launcher.rs +++ b/crates/gpapi/src/process/hip_launcher.rs @@ -72,18 +72,14 @@ impl<'a> HipLauncher<'a> { cmd.env("APP_VERSION", client_version); } - let child = cmd - .kill_on_drop(true) - .stdout(Stdio::piped()) - .spawn(); + let child = cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn(); - if child.is_err() { - bail!("Failed to spawn {}: {}", self.program, child.unwrap_err()) - } + let child = match child { + Ok(child) => child, + Err(err) => bail!("Failed to spawn {}: {}", self.program, err), + }; - let output = child.unwrap() - .wait_with_output() - .await?; + let output = child.wait_with_output().await?; if let Some(exit_status) = output.status.code() { if exit_status != 0 {