Compare commits

..

1 Commits

Author SHA1 Message Date
jasonwitty f28635d6ad fix(deps): bump aws-lc-rs 1.15.0 -> 1.17.1 to patch aws-lc-sys advisories
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
Resolves all five open Dependabot alerts (GHSA-9f94-5g5w-gf6r,
GHSA-394x-vwmw-crm3, GHSA-hfpc-8r3f-gw53, GHSA-65p9-r9h6-22vj,
GHSA-vw5v-4f2q-w9xf) by moving aws-lc-sys from 0.33.0 to 0.42.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 15:07:13 -07:00
+4 -57
View File
@@ -382,16 +382,7 @@ fn gather_intervals(
async fn run_demo_mode(_tls_ca: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
let port = 3231;
let url = format!("ws://127.0.0.1:{port}/ws");
let child = match spawn_demo_agent(port) {
Ok(child) => child,
// The agent ships as its own binary, so a missing one is a setup problem,
// not a crash: tell the user how to fix it instead of dumping an io error.
Err(e @ DemoAgentError::NotFound(_)) => {
eprintln!("{e}");
return Ok(());
}
Err(e) => return Err(e.into()),
};
let child = spawn_demo_agent(port)?;
let mut app = App::new();
// Demo mode connects to localhost, so disable hostname verification
tokio::select! { res=app.run(&url,None,false)=>{ drop(child); res } _=tokio::signal::ctrl_c()=>{ drop(child); Ok(()) } }
@@ -408,50 +399,9 @@ impl Drop for DemoGuard {
eprintln!("Stopped demo agent on port {}", self.port);
}
}
#[derive(Debug)]
enum DemoAgentError {
/// The socktop_agent executable could not be located.
NotFound(std::path::PathBuf),
Io(std::io::Error),
}
impl std::fmt::Display for DemoAgentError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::NotFound(candidate) => write!(
f,
"Could not start demo mode: '{}' was not found{}.\n\
\n\
Demo mode runs a local agent, which is shipped as a separate binary\n\
and is not installed alongside the socktop TUI. Install it with:\n\
\n cargo install socktop_agent\n\n\
then run socktop again. See {} for other install options.",
candidate.display(),
// A bare file name means find_agent_executable() fell back to a PATH lookup.
if candidate.parent().is_none_or(|p| p.as_os_str().is_empty()) {
" on your PATH"
} else {
""
},
env!("CARGO_PKG_HOMEPAGE"),
),
Self::Io(e) => write!(f, "Could not start demo mode: {e}"),
}
}
}
impl std::error::Error for DemoAgentError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::NotFound(_) => None,
Self::Io(e) => Some(e),
}
}
}
fn spawn_demo_agent(port: u16) -> Result<DemoGuard, DemoAgentError> {
fn spawn_demo_agent(port: u16) -> Result<DemoGuard, Box<dyn std::error::Error>> {
let candidate = find_agent_executable();
let mut cmd = std::process::Command::new(&candidate);
let mut cmd = std::process::Command::new(candidate);
cmd.arg("--port").arg(port.to_string());
cmd.env("SOCKTOP_ENABLE_SSL", "0");
@@ -459,10 +409,7 @@ fn spawn_demo_agent(port: u16) -> Result<DemoGuard, DemoAgentError> {
//cmd.env("SOCKTOP_AGENT_GPU", "0");
//cmd.env("SOCKTOP_AGENT_TEMP", "0");
let child = cmd.spawn().map_err(|e| match e.kind() {
std::io::ErrorKind::NotFound => DemoAgentError::NotFound(candidate),
_ => DemoAgentError::Io(e),
})?;
let child = cmd.spawn()?;
std::thread::sleep(std::time::Duration::from_millis(300));
Ok(DemoGuard {
port,