(path: &Path)
| 887 | } |
| 888 | |
| 889 | fn read_receipt(path: &Path) -> ReceiptLookup { |
| 890 | match std::fs::read_to_string(path) { |
| 891 | Ok(text) => match serde_json::from_str::<Receipt>(&text) { |
| 892 | Ok(receipt) => ReceiptLookup::Found(receipt), |
| 893 | Err(error) => ReceiptLookup::Unreadable(ReceiptError::Parse(error.classify())), |
| 894 | }, |
| 895 | Err(error) if error.kind() == ErrorKind::NotFound && demonstrably_missing(path) => { |
| 896 | ReceiptLookup::Absent |
| 897 | } |
| 898 | Err(error) => ReceiptLookup::Unreadable(ReceiptError::Read(error.kind())), |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | /// Agent directories under the integrations root that hold a receipt. |
| 903 | fn receipts_on_disk(root: &Path) -> Vec<String> { |
no test coverage detected