Skip to content

Commit 5568b68

Browse files
committed
---
yaml --- r: 14675 b: refs/heads/try c: b8c8e43 h: refs/heads/master i: 14673: 8ce6e96 14671: fdc8c37 v: v3
1 parent 9f54ff8 commit 5568b68

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: fc9b55d65f4854e22321095ae07d1ba9d39fe86d
5+
refs/heads/try: b8c8e43381b2b5814ca4965d2e883f78a771f262
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustdoc/markdown_writer.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,40 @@ fn pandoc_writer(
100100
os::close(pipe_out.out);
101101
os::close(pipe_err.out);
102102
os::close(pipe_in.out);
103-
os::close(pipe_out.in);
104-
os::close(pipe_err.in);
103+
104+
let stdout = result::get(task::try {||
105+
readclose(pipe_out.in)
106+
});
107+
let stderr = result::get(task::try {||
108+
readclose(pipe_err.in)
109+
});
105110

106111
let status = run::waitpid(pid);
107112
#debug("pandoc result: %i", status);
108113
if status != 0 {
114+
#error("pandoc-out: %s", stdout);
115+
#error("pandoc-err: %s", stderr);
109116
fail "pandoc failed";
110117
}
111118
}
112119
}
113120

121+
fn readclose(fd: ctypes::fd_t) -> str {
122+
import std::os;
123+
import std::io;
124+
125+
// Copied from run::program_output
126+
let file = os::fd_FILE(fd);
127+
let reader = io::FILE_reader(file, false);
128+
let buf = "";
129+
while !reader.eof() {
130+
let bytes = reader.read_bytes(4096u);
131+
buf += str::from_bytes(bytes);
132+
}
133+
os::fclose(file);
134+
ret buf;
135+
}
136+
114137
fn generic_writer(process: fn~(markdown: str)) -> writer {
115138
let ch = task::spawn_listener {|po: comm::port<writeinstr>|
116139
let markdown = "";

0 commit comments

Comments
 (0)