mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Fix clippy warnings and format code
- Fix redundant closure warning in api_server.rs - Add backticks to login_tty in documentation comments - All clippy warnings resolved
This commit is contained in:
parent
f0658bccd0
commit
5f067c7a80
2 changed files with 14 additions and 10 deletions
|
|
@ -1045,9 +1045,10 @@ fn handle_session_kill(control_path: &Path, path: &str) -> Response<String> {
|
|||
let mut process_died = false;
|
||||
if let Ok(content) = std::fs::read_to_string(&session_json_path) {
|
||||
if let Ok(session_info) = serde_json::from_str::<serde_json::Value>(&content) {
|
||||
if let Some(pid) = session_info.get("pid").and_then(|p| p.as_u64()) {
|
||||
if let Some(pid) = session_info.get("pid").and_then(serde_json::Value::as_u64) {
|
||||
// Wait for the process to actually die
|
||||
for _ in 0..30 { // 30 * 100ms = 3 seconds max
|
||||
for _ in 0..30 {
|
||||
// 30 * 100ms = 3 seconds max
|
||||
if !sessions::is_pid_alive(pid as u32) {
|
||||
process_died = true;
|
||||
break;
|
||||
|
|
@ -1072,9 +1073,12 @@ fn handle_session_kill(control_path: &Path, path: &str) -> Response<String> {
|
|||
if process_died {
|
||||
(StatusCode::OK, "Session killed")
|
||||
} else {
|
||||
(StatusCode::OK, "Session kill signal sent (process may still be terminating)")
|
||||
(
|
||||
StatusCode::OK,
|
||||
"Session kill signal sent (process may still be terminating)",
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
Err(e) => {
|
||||
let response = ApiResponse {
|
||||
success: None,
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ use tempfile::NamedTempFile;
|
|||
|
||||
pub const DEFAULT_TERM: &str = "xterm-256color";
|
||||
|
||||
/// Cross-platform implementation of login_tty
|
||||
/// On systems with login_tty, use it directly. Otherwise, implement manually.
|
||||
/// Cross-platform implementation of `login_tty`
|
||||
/// On systems with `login_tty`, use it directly. Otherwise, implement manually.
|
||||
#[cfg(any(
|
||||
target_os = "macos",
|
||||
target_os = "freebsd",
|
||||
|
|
|
|||
Loading…
Reference in a new issue