Formatting

This commit is contained in:
Timmy
2026-04-09 17:58:29 +01:00
parent 1ffdd75475
commit bb865687d5
+21 -11
View File
@@ -131,12 +131,12 @@ async fn main() -> Result<(), std::io::Error> {
// as PID 1 for this. For native macOS/Linux, poll waitpid(-1, WNOHANG) in a
// background thread so orphaned grandchildren don't accumulate as zombies.
#[cfg(unix)]
std::thread::spawn(|| loop {
// SAFETY: waitpid(-1, ...) with WNOHANG is always safe to call.
unsafe {
while libc::waitpid(-1, std::ptr::null_mut(), libc::WNOHANG) > 0 {}
std::thread::spawn(|| {
loop {
// SAFETY: waitpid(-1, ...) with WNOHANG is always safe to call.
unsafe { while libc::waitpid(-1, std::ptr::null_mut(), libc::WNOHANG) > 0 {} }
std::thread::sleep(std::time::Duration::from_secs(5));
}
std::thread::sleep(std::time::Duration::from_secs(5));
});
let app_state = Arc::new(SessionState::default());
@@ -151,9 +151,7 @@ async fn main() -> Result<(), std::io::Error> {
}
let _ = std::fs::rename(&legacy_store_path, &store_path);
}
let store = Arc::new(
JsonFileStore::from_path(store_path).map_err(std::io::Error::other)?,
);
let store = Arc::new(JsonFileStore::from_path(store_path).map_err(std::io::Error::other)?);
// Collect CLI args, skipping the binary name (argv[0]).
let raw_args: Vec<String> = std::env::args().skip(1).collect();
@@ -193,7 +191,10 @@ async fn main() -> Result<(), std::io::Error> {
let init_root = explicit_path.unwrap_or_else(|| cwd.clone());
if !init_root.exists() {
std::fs::create_dir_all(&init_root).unwrap_or_else(|e| {
eprintln!("error: cannot create directory {}: {e}", init_root.display());
eprintln!(
"error: cannot create directory {}: {e}",
init_root.display()
);
std::process::exit(1);
});
}
@@ -837,7 +838,11 @@ name = "coder"
#[test]
fn parse_port_with_path() {
let args = vec!["--port".to_string(), "4200".to_string(), "/some/path".to_string()];
let args = vec![
"--port".to_string(),
"4200".to_string(),
"/some/path".to_string(),
];
let result = parse_cli_args(&args).unwrap();
assert_eq!(result.port, Some(4200));
assert_eq!(result.path, Some("/some/path".to_string()));
@@ -865,7 +870,12 @@ name = "coder"
#[test]
fn parse_init_with_path_and_port() {
let args = vec!["init".to_string(), "--port".to_string(), "3000".to_string(), "/my/project".to_string()];
let args = vec![
"init".to_string(),
"--port".to_string(),
"3000".to_string(),
"/my/project".to_string(),
];
let result = parse_cli_args(&args).unwrap();
assert!(result.init);
assert_eq!(result.port, Some(3000));