palaver 0.2.8

Cross-platform polyfills. This library attempts to provide reliable polyfills for functionality that isn't implemented on all platforms.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use palaver::env::exe;
#[cfg(unix)]
use palaver::file::FdIter;

fn main() {
	let _ = exe().unwrap();
	#[cfg(unix)]
	{
		// Rust testing framework occasionally gives us 0, 1, 2, 6 ???
		assert_eq!(FdIter::new().unwrap().collect::<Vec<_>>()[..3], [0, 1, 2]);
		for fd in FdIter::new().unwrap().take(3) {
			println!("{:?}", fd);
			// seems to fail on Azure Pipeline's ubuntu-16.04, possibly as it's containerized?
			// let _ = fs::File::open(fd_path(fd).unwrap()).unwrap();
		}
	}
}