rustdoc: Add some more error reporting for pandoc
This commit is contained in:
parent
fc9b55d65f
commit
b8c8e43381
|
@ -100,17 +100,40 @@ fn pandoc_writer(
|
||||||
os::close(pipe_out.out);
|
os::close(pipe_out.out);
|
||||||
os::close(pipe_err.out);
|
os::close(pipe_err.out);
|
||||||
os::close(pipe_in.out);
|
os::close(pipe_in.out);
|
||||||
os::close(pipe_out.in);
|
|
||||||
os::close(pipe_err.in);
|
let stdout = result::get(task::try {||
|
||||||
|
readclose(pipe_out.in)
|
||||||
|
});
|
||||||
|
let stderr = result::get(task::try {||
|
||||||
|
readclose(pipe_err.in)
|
||||||
|
});
|
||||||
|
|
||||||
let status = run::waitpid(pid);
|
let status = run::waitpid(pid);
|
||||||
#debug("pandoc result: %i", status);
|
#debug("pandoc result: %i", status);
|
||||||
if status != 0 {
|
if status != 0 {
|
||||||
|
#error("pandoc-out: %s", stdout);
|
||||||
|
#error("pandoc-err: %s", stderr);
|
||||||
fail "pandoc failed";
|
fail "pandoc failed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn readclose(fd: ctypes::fd_t) -> str {
|
||||||
|
import std::os;
|
||||||
|
import std::io;
|
||||||
|
|
||||||
|
// Copied from run::program_output
|
||||||
|
let file = os::fd_FILE(fd);
|
||||||
|
let reader = io::FILE_reader(file, false);
|
||||||
|
let buf = "";
|
||||||
|
while !reader.eof() {
|
||||||
|
let bytes = reader.read_bytes(4096u);
|
||||||
|
buf += str::from_bytes(bytes);
|
||||||
|
}
|
||||||
|
os::fclose(file);
|
||||||
|
ret buf;
|
||||||
|
}
|
||||||
|
|
||||||
fn generic_writer(process: fn~(markdown: str)) -> writer {
|
fn generic_writer(process: fn~(markdown: str)) -> writer {
|
||||||
let ch = task::spawn_listener {|po: comm::port<writeinstr>|
|
let ch = task::spawn_listener {|po: comm::port<writeinstr>|
|
||||||
let markdown = "";
|
let markdown = "";
|
||||||
|
|
Loading…
Reference in New Issue