fix(linux): always watch CUPS capture cache
Some checks failed
Desktop Release / Bootstrap updater signing key (push) Has been cancelled
Desktop Release / Windows x64 NSIS (push) Has been cancelled
Desktop Release / Linux x64 DEB + AppImage (push) Has been cancelled
Desktop Release / Publish public desktop release (push) Has been cancelled

This commit is contained in:
Admin 2026-09-24 09:19:46 +00:00
parent 0e619753f1
commit 75e5d36f70
2 changed files with 31 additions and 25 deletions

View File

@ -63,6 +63,12 @@ pub fn start(config: AppConfig, state: SharedState, app: AppHandle) -> Result<Ca
if matches!(config.mode, CaptureMode::SpoolFolder | CaptureMode::Both) {
let spool_dir = PathBuf::from(&config.spool_dir);
#[cfg(target_os = "linux")]
let is_system_cups_spool = spool_dir == PathBuf::from(SYSTEM_CUPS_SPOOL_DIR);
#[cfg(not(target_os = "linux"))]
let is_system_cups_spool = false;
if !is_system_cups_spool {
fs::create_dir_all(&spool_dir)
.with_context(|| format!("create spool capture directory {}", spool_dir.display()))?;
@ -82,11 +88,11 @@ pub fn start(config: AppConfig, state: SharedState, app: AppHandle) -> Result<Ca
)
}));
}
}
#[cfg(target_os = "linux")]
{
let system_spool = PathBuf::from(SYSTEM_CUPS_SPOOL_DIR);
if system_spool != PathBuf::from(&config.spool_dir) {
let worker_stop = stop.clone();
let worker_state = state.clone();
let worker_app = app.clone();
@ -100,7 +106,6 @@ pub fn start(config: AppConfig, state: SharedState, app: AppHandle) -> Result<Ca
worker_stop,
)
}));
}
let sink = TcpListener::bind(TEST_CAPTURE_SINK_ADDR)
.with_context(|| format!("bind test-capture sink {TEST_CAPTURE_SINK_ADDR}"))?;

View File

@ -37,7 +37,8 @@ job_id = safe(sys.argv[1] if len(sys.argv) > 1 else "job")
title = safe(sys.argv[3] if len(sys.argv) > 3 else "print")
printer = safe(os.environ.get("PRINTER", "printer"))
prefix = "test-" if printer.lower() == "fieldlens-test-capture" else "print-"
name = f"{prefix}{printer}-{job_id}-{title}.pdf"
suffix = "" if title.lower().endswith(".pdf") else ".pdf"
name = f"{prefix}{printer}-{job_id}-{title}{suffix}"
final_path = os.path.join(CACHE, name)
part_path = final_path + ".part"