From ef6cc38b32529c0504dc0d8aae31b63aab138a56 Mon Sep 17 00:00:00 2001 From: ib <32579486+ErrWare@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:02:42 -0600 Subject: [PATCH] Clarify server's cache-not-found message. The new typical use case looks like this: ``` ./liblisa-semantics-tool server --cache mycache.cache semantics/amd-7700x.json Creating cache "mycache.cache" Reading... Building lookup table... That took 112565ms Ready! ``` --- cli/liblisa-semantics-tool/src/server.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cli/liblisa-semantics-tool/src/server.rs b/cli/liblisa-semantics-tool/src/server.rs index 3a79b2c..8435cdf 100644 --- a/cli/liblisa-semantics-tool/src/server.rs +++ b/cli/liblisa-semantics-tool/src/server.rs @@ -1,6 +1,6 @@ use std::fmt::{Debug, Display}; use std::fs::File; -use std::io::{BufReader, BufWriter}; +use std::io::{BufReader, BufWriter, ErrorKind}; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::time::Instant; @@ -247,11 +247,13 @@ impl Server { bincode::deserialize_from(BufReader::new(file)).unwrap() }, Err(e) => { - eprintln!("Error reading {cache:?}: {e}"); + match e.kind() { + ErrorKind::NotFound => eprintln!("Creating cache {cache:?}"), + _ => eprintln!("Error reading {cache:?}: {e}"), + } let map = build_filter_map(&self.encodings); - eprintln!("Writing cache to {cache:?}"); bincode::serialize_into(BufWriter::new(File::create(cache).unwrap()), &map).unwrap(); map },