Closed as not planned
Closed as not planned
Description
Not much to it. I have this bit of code:
fn get_line_count(file_name: String) -> Result<usize, Error> {
let file = try!(OpenOptions::new().append(true).create(true).open(&file_name));
let f = BufReader::new(file);
Ok(f.lines().count())
}
And I'm passing in a file that exists, but is empty (actually, by the timestamp, the file probably didn't exist until the first line in the function created it):
ls -la new_chunks.txt
-rw-rw-r-- 1 joel joel 0 Jul 7 07:38 new_chunks.txt
My program wasn't going anywhere, but it was using up 100% of one core. Some println
s later and I found that it couldn't get past Ok(f.lines().count())
. Specifically it was the call to count()
that wasn't returning.
This is Ubuntu 14.04. rustup show
:
active toolchain
----------------
stable-x86_64-unknown-linux-gnu (default)
rustc 1.9.0 (e4e8b6668 2016-05-18)
Edit: This was running in release mode, but I confirmed it in debug mode too. I also tried the current beta and nightly channels in release and debug mode:
beta-x86_64-unknown-linux-gnu (directory override for '/home/joel/dirname/dirname/project')
rustc 1.11.0-beta.1 (8dc253bcf 2016-07-05)
nightly-x86_64-unknown-linux-gnu (directory override for '/home/joel/dirname/dirname/project')
rustc 1.11.0-nightly (696b703b5 2016-07-03)