From 0ee88083dfb649fa367f18082222cdeabcda63a8 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Sat, 9 Mar 2024 20:32:42 +0100 Subject: ipc: Improve error message. - If we can't open the socket, include the socket's file name as context. --- ipc/src/assuan/socket/windows.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipc/src/assuan/socket/windows.rs b/ipc/src/assuan/socket/windows.rs index 02841e09..0ae207de 100644 --- a/ipc/src/assuan/socket/windows.rs +++ b/ipc/src/assuan/socket/windows.rs @@ -48,7 +48,9 @@ pub enum UdsEmulation { /// /// Inspired by `read_port_and nonce` from assuan-socket.c. pub fn read_port_and_nonce(fname: &Path) -> Result { - let mut file = File::open(fname)?; + let mut file = File::open(fname).with_context(|| { + format!("Opening gpg-agent socket {}", fname.display()) + })?; // Socket connection info will be in either a <= 54 byte long Cygwin format // or ~5+1+16 (modulo whitespace separators) custom libassuan format let mut contents = Vec::with_capacity(64); -- cgit v1.2.3