Remove CEF: the web content crate, ElyMark's page, their packaging, licences and tests (C14.5)
PRD and agents.md name the native route; ElyMail's body will not use CEF or Electron. ElyMark's package carries the KaTeX fonts' OFL. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2e8379b0b1
commit
8a942e6d80
77 files changed
+105
-10718
No files matched your search
@@ -83,34 +83,11 @@ pub fn open(app: AppId, files: &[PathBuf]) -> io::Result<()> {
|
||||
}
|
||||
let mut command = Command::new(&found);
|
||||
command.args(files);
|
||||
let child = fresh_signals(&mut command).spawn()?;
|
||||
let child = command.spawn()?;
|
||||
log::info!("apps: started {} as {}", app.name(), child.id());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The started app takes signals as from a shell.
|
||||
#[cfg(unix)]
|
||||
fn fresh_signals(command: &mut Command) -> &mut Command {
|
||||
use std::os::unix::process::CommandExt as _;
|
||||
// Chromium's ignored or blocked signals would carry over.
|
||||
unsafe {
|
||||
command.pre_exec(|| {
|
||||
for signal in [libc::SIGTERM, libc::SIGINT, libc::SIGHUP, libc::SIGQUIT] {
|
||||
libc::signal(signal, libc::SIG_DFL);
|
||||
}
|
||||
let mut none: libc::sigset_t = std::mem::zeroed();
|
||||
libc::sigemptyset(&mut none);
|
||||
libc::pthread_sigmask(libc::SIG_SETMASK, &none, std::ptr::null_mut());
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
fn fresh_signals(command: &mut Command) -> &mut Command {
|
||||
command
|
||||
}
|
||||
|
||||
/// Opens `path` in the default app; a refusal says why.
|
||||
pub fn open_default(path: &Path) -> io::Result<()> {
|
||||
let mut command = if cfg!(target_os = "macos") {
|
||||
@@ -170,28 +147,3 @@ mod tests {
|
||||
))));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, unix))]
|
||||
mod signals {
|
||||
use std::os::unix::process::ExitStatusExt as _;
|
||||
|
||||
/// A starter that ignores and blocks SIGTERM, as Chromium may.
|
||||
#[test]
|
||||
fn a_started_app_still_stops_on_sigterm() {
|
||||
unsafe {
|
||||
libc::signal(libc::SIGTERM, libc::SIG_IGN);
|
||||
let mut term: libc::sigset_t = std::mem::zeroed();
|
||||
libc::sigemptyset(&mut term);
|
||||
libc::sigaddset(&mut term, libc::SIGTERM);
|
||||
libc::pthread_sigmask(libc::SIG_BLOCK, &term, std::ptr::null_mut());
|
||||
}
|
||||
let mut command = std::process::Command::new("/bin/sleep");
|
||||
command.arg("30");
|
||||
let mut child = super::fresh_signals(&mut command).spawn().unwrap();
|
||||
std::thread::sleep(std::time::Duration::from_millis(200));
|
||||
unsafe { libc::kill(child.id() as i32, libc::SIGTERM) };
|
||||
let status = child.wait().unwrap();
|
||||
unsafe { libc::signal(libc::SIGTERM, libc::SIG_DFL) };
|
||||
assert_eq!(status.signal(), Some(libc::SIGTERM), "{status:?}");
|
||||
}
|
||||
}
|
||||
@@ -11,18 +11,15 @@ use crate::AppId;
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Kind {
|
||||
Log,
|
||||
/// The web content cache (ElyMark).
|
||||
Cache,
|
||||
Recovery,
|
||||
}
|
||||
|
||||
impl Kind {
|
||||
pub const ALL: [Kind; 3] = [Kind::Log, Kind::Cache, Kind::Recovery];
|
||||
pub const ALL: [Kind; 2] = [Kind::Log, Kind::Recovery];
|
||||
|
||||
fn place(self) -> &'static str {
|
||||
match self {
|
||||
Kind::Log => "ely.log",
|
||||
Kind::Cache => "web",
|
||||
Kind::Recovery => "recovery",
|
||||
}
|
||||
}
|
||||
@@ -152,15 +149,14 @@ mod tests {
|
||||
#[test]
|
||||
fn marked_kinds_go_at_start_and_others_stay() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
std::fs::create_dir_all(dir.path().join("web/Cache")).unwrap();
|
||||
std::fs::write(dir.path().join("web/Cache/blob"), vec![0u8; 4096]).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join("recovery/a")).unwrap();
|
||||
std::fs::write(dir.path().join("recovery/a/point"), b"text").unwrap();
|
||||
assert_eq!(size(&dir.path().join("web")).unwrap(), 4096);
|
||||
std::fs::write(dir.path().join(Kind::Cache.mark()), b"").unwrap();
|
||||
std::fs::write(dir.path().join("recovery/a/point"), vec![0u8; 4096]).unwrap();
|
||||
std::fs::write(dir.path().join("ely.log"), b"line").unwrap();
|
||||
assert_eq!(size(&dir.path().join("recovery")).unwrap(), 4096);
|
||||
std::fs::write(dir.path().join(Kind::Recovery.mark()), b"").unwrap();
|
||||
clear_marked_in(dir.path()).unwrap();
|
||||
assert!(!dir.path().join("web").exists(), "the cache went");
|
||||
assert!(dir.path().join("recovery/a/point").exists(), "unmarked kinds stay");
|
||||
assert!(!dir.path().join(Kind::Cache.mark()).exists(), "the mark is spent");
|
||||
assert!(!dir.path().join("recovery").exists(), "the copies went");
|
||||
assert!(dir.path().join("ely.log").exists(), "the log stays");
|
||||
assert!(!dir.path().join(Kind::Recovery.mark()).exists(), "the mark is spent");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user