pub fn open_file_or_duplicate<P: AsRef<Path>>(
    path: P,
    options: &OpenOptions
) -> Result<File>
Expand description

Open the file with the given path, or if it is of the form /proc/self/fd/N then just use the file descriptor.

Note that this will not work properly if the same /proc/self/fd/N path is used twice in different places, as the metadata (including the offset) will be shared between both file descriptors.