We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 096c434 + 3512fb0 commit 7021f15Copy full SHA for 7021f15
src/libstd/sys/unix/os.rs
@@ -283,11 +283,14 @@ pub fn current_exe() -> io::Result<PathBuf> {
283
284
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
285
pub fn current_exe() -> io::Result<PathBuf> {
286
- let selfexe = PathBuf::from("/proc/self/exe");
287
- if selfexe.exists() {
288
- ::fs::read_link(selfexe)
289
- } else {
290
- Err(io::Error::new(io::ErrorKind::Other, "no /proc/self/exe available. Is /proc mounted?"))
+ match ::fs::read_link("/proc/self/exe") {
+ Err(ref e) if e.kind() == io::ErrorKind::NotFound => {
+ Err(io::Error::new(
+ io::ErrorKind::Other,
+ "no /proc/self/exe available. Is /proc mounted?"
291
+ ))
292
+ },
293
+ other => other,
294
}
295
296
0 commit comments