Skip to content

Commit 3bd0338

Browse files
committedFeb 7, 2012
Revert "log to stderr instead of stdout"
This is causing mysterious hangs on windows. Issue #1769. This reverts commit d65eabd.
1 parent 5563eab commit 3bd0338

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed
 

‎src/comp/driver/diagnostic.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ fn diagnosticcolor(lvl: level) -> u8 {
159159

160160
fn print_diagnostic(topic: str, lvl: level, msg: str) {
161161
if str::is_not_empty(topic) {
162-
io::stderr().write_str(#fmt["%s ", topic]);
162+
io::stdout().write_str(#fmt["%s ", topic]);
163163
}
164164
if term::color_supported() {
165-
term::fg(io::stderr(), diagnosticcolor(lvl));
165+
term::fg(io::stdout(), diagnosticcolor(lvl));
166166
}
167-
io::stderr().write_str(#fmt["%s:", diagnosticstr(lvl)]);
167+
io::stdout().write_str(#fmt["%s:", diagnosticstr(lvl)]);
168168
if term::color_supported() {
169-
term::reset(io::stderr());
169+
term::reset(io::stdout());
170170
}
171-
io::stderr().write_str(#fmt[" %s\n", msg]);
171+
io::stdout().write_str(#fmt[" %s\n", msg]);
172172
}
173173

174174
fn emit(cmsp: option<(codemap::codemap, span)>,
@@ -202,10 +202,10 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
202202
}
203203
// Print the offending lines
204204
for line: uint in display_lines {
205-
io::stderr().write_str(#fmt["%s:%u ", fm.name, line + 1u]);
205+
io::stdout().write_str(#fmt["%s:%u ", fm.name, line + 1u]);
206206
let s = codemap::get_line(fm, line as int);
207207
if !str::ends_with(s, "\n") { s += "\n"; }
208-
io::stderr().write_str(s);
208+
io::stdout().write_str(s);
209209
}
210210
if elided {
211211
let last_line = display_lines[vec::len(display_lines) - 1u];
@@ -214,7 +214,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
214214
let out = "";
215215
while indent > 0u { out += " "; indent -= 1u; }
216216
out += "...\n";
217-
io::stderr().write_str(out);
217+
io::stdout().write_str(out);
218218
}
219219

220220

@@ -239,7 +239,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
239239
let width = hi.col - lo.col - 1u;
240240
while width > 0u { str::push_char(s, '~'); width -= 1u; }
241241
}
242-
io::stderr().write_str(s + "\n");
242+
io::stdout().write_str(s + "\n");
243243
}
244244
}
245245

‎src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ fn check_error_patterns(props: test_props,
199199

200200
let next_err_idx = 0u;
201201
let next_err_pat = props.error_patterns[next_err_idx];
202-
for line: str in str::split(procres.stderr, '\n' as u8) {
202+
for line: str in str::split(procres.stdout, '\n' as u8) {
203203
if str::find(line, next_err_pat) > 0 {
204204
#debug("found error pattern %s", next_err_pat);
205205
next_err_idx += 1u;
@@ -246,7 +246,7 @@ fn check_expected_errors(expected_errors: [errors::expected_error],
246246
// filename:line1:col1: line2:col2: *warning:* msg
247247
// where line1:col1: is the starting point, line2:col2:
248248
// is the ending point, and * represents ANSI color codes.
249-
for line: str in str::split(procres.stderr, '\n' as u8) {
249+
for line: str in str::split(procres.stdout, '\n' as u8) {
250250
let was_expected = false;
251251
vec::iteri(expected_errors) {|i, ee|
252252
if !found_flags[i] {

‎src/rt/rust_srv.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ rust_srv::realloc(void *p, size_t bytes) {
2525

2626
void
2727
rust_srv::log(char const *msg) {
28-
fprintf(stderr, "rust: %s\n", msg);
28+
printf("rust: %s\n", msg);
29+
// FIXME: flushing each time is expensive, but at the moment
30+
// necessary to get output through before a rust_task::fail
31+
// call. This should be changed.
32+
fflush(stdout);
2933
}
3034

3135
void

0 commit comments

Comments
 (0)
Please sign in to comment.