修复发布构建编译错误

This commit is contained in:
2026-05-25 11:14:39 +08:00
parent 8ea2fd028e
commit 4b2b5a2df6
5 changed files with 26 additions and 18 deletions

View File

@@ -166,9 +166,11 @@ async fn system_snapshot() -> Result<Value> {
)
.await
.unwrap_or_default();
let ports = command_lines(Command::new("ss").args(["-H", "-tulpen"]), 8)
.await
.or_else(|_| command_lines(Command::new("netstat").args(["-tulpen"]), 8).await)
let ports_result = match command_lines(Command::new("ss").args(["-H", "-tulpen"]), 8).await {
Ok(lines) => Ok(lines),
Err(_) => command_lines(Command::new("netstat").args(["-tulpen"]), 8).await,
};
let ports = ports_result
.unwrap_or_default()
.into_iter()
.take(80)
@@ -762,9 +764,14 @@ async fn nginx_ssl_status() -> Result<Value> {
.unwrap_or(false);
let version = certbot
.as_ref()
.map(stderr_text)
.filter(|text| !text.trim().is_empty())
.or_else(|| certbot.as_ref().map(stdout_text))
.map(|output| {
let stderr = stderr_text(output);
if stderr.trim().is_empty() {
stdout_text(output)
} else {
stderr
}
})
.unwrap_or_default();
let certbot_timer = run_command(
Command::new("systemctl").args(["is-enabled", "certbot.timer"]),
@@ -1776,7 +1783,7 @@ fn push_unique_json_string(obj: &mut serde_json::Map<String, Value>, key: &str,
if value.is_empty() {
return;
}
let values = obj.entry(key.into()).or_insert_with(|| json!([]));
let values = obj.entry(key.to_string()).or_insert_with(|| json!([]));
if let Some(array) = values.as_array_mut() {
if !array.iter().any(|item| item.as_str() == Some(value)) {
array.push(json!(value));

View File

@@ -41,8 +41,8 @@ pub fn open(
pixel_height: 0,
})?;
let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_string());
let mut cmd = CommandBuilder::new(shell);
open_with_command(stream_id, tx, pair, &mut cmd)
let cmd = CommandBuilder::new(shell);
open_with_command(stream_id, tx, pair, cmd)
}
pub fn open_docker_exec(
@@ -71,14 +71,14 @@ pub fn open_docker_exec(
cmd.arg("-it");
cmd.arg(container_id);
cmd.arg(shell);
open_with_command(stream_id, tx, pair, &mut cmd)
open_with_command(stream_id, tx, pair, cmd)
}
fn open_with_command(
stream_id: String,
tx: mpsc::UnboundedSender<AgentMessage>,
pair: portable_pty::PtyPair,
cmd: &mut CommandBuilder,
mut cmd: CommandBuilder,
) -> Result<TerminalHandle> {
cmd.env("TERM", "xterm-256color");
let mut child = pair.slave.spawn_command(cmd)?;