We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 997ffb6 commit a5e8c4eCopy full SHA for a5e8c4e
src/unix.rs
@@ -114,17 +114,17 @@ impl Client {
114
})?;
115
let path = Path::new(path_str);
116
117
- let file = OpenOptions::new()
118
- .read(true)
119
- .write(true)
120
- .open(path)
121
- .map_err(|err| FromEnvErrorInner::CannotOpenPath(path_str.to_string(), err))?;
+ let open_file = || {
+ OpenOptions::new()
+ .read(true)
+ .write(true)
+ .open(path)
122
+ .map_err(|err| FromEnvErrorInner::CannotOpenPath(path_str.to_string(), err))
123
+ };
124
125
Ok(Some(Client {
- read: file
- .try_clone()
126
- .map_err(|err| FromEnvErrorInner::CannotClone(file.as_raw_fd(), err))?,
127
- write: file,
+ read: open_file()?,
+ write: open_file()?,
128
creation_arg: ClientCreationArg::Fifo(path.into()),
129
is_non_blocking: Some(AtomicBool::new(false)),
130
}))
0 commit comments