fix(mcp): gate unix-only spill permission APIs for windows builds

This commit is contained in:
2026-08-25 11:37:41 -06:00
parent c8b00b20bc
commit a4b55d9e42
+7 -2
View File
@@ -11,6 +11,7 @@ use std::fmt;
use std::fs::{self, OpenOptions}; use std::fs::{self, OpenOptions};
use std::io::{ErrorKind, Read, Write}; use std::io::{ErrorKind, Read, Write};
#[cfg(unix)] #[cfg(unix)]
#[cfg(unix)]
use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::OpenOptionsExt;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::time::SystemTime; use std::time::SystemTime;
@@ -390,6 +391,7 @@ mod tests {
use super::*; use super::*;
use base64::Engine; use base64::Engine;
use std::env; use std::env;
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
use std::process; use std::process;
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::atomic::{AtomicUsize, Ordering};
@@ -642,8 +644,11 @@ mod tests {
assert!(!meta.sniffed); assert!(!meta.sniffed);
assert!(meta.spilled); assert!(meta.spilled);
assert_eq!(fs::read(&meta.path).unwrap(), data); assert_eq!(fs::read(&meta.path).unwrap(), data);
let mode = fs::metadata(&meta.path).unwrap().permissions().mode(); #[cfg(unix)]
assert_eq!(mode & 0o777, 0o600); {
let mode = fs::metadata(&meta.path).unwrap().permissions().mode();
assert_eq!(mode & 0o777, 0o600);
}
}); });
} }