Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rustdoc: Make markdown_writer::pandoc_writer UTF-8 safe
  • Loading branch information
tychosci committed Oct 18, 2012
1 parent c0cee3e commit 6ce4cf7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/rustdoc/markdown_writer.rs
Expand Up @@ -136,13 +136,15 @@ fn readclose(fd: libc::c_int) -> ~str {
// Copied from run::program_output
let file = os::fdopen(fd);
let reader = io::FILE_reader(file, false);
let mut buf = ~"";
while !reader.eof() {
let bytes = reader.read_bytes(4096u);
buf += str::from_bytes(bytes);
}
let buf = io::with_bytes_writer(|writer| {
let mut bytes = [mut 0, ..4096];
while !reader.eof() {
let nread = reader.read(bytes, bytes.len());
writer.write(bytes.view(0, nread));
}
});
os::fclose(file);
return buf;
str::from_bytes(buf)
}

fn generic_writer(+process: fn~(markdown: ~str)) -> Writer {
Expand Down

0 comments on commit 6ce4cf7

Please sign in to comment.