Skip to content

Commit 2c80556

Browse files
committed
Merge pull request #875 from erickt/master
Exposing STDERR to rust
2 parents 614a930 + b199e9d commit 2c80556

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

src/lib/io.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import os::libc;
44
native "rust" mod rustrt {
55
fn rust_get_stdin() -> os::libc::FILE;
66
fn rust_get_stdout() -> os::libc::FILE;
7+
fn rust_get_stderr() -> os::libc::FILE;
78
}
89

910

@@ -374,6 +375,7 @@ fn buffered_file_buf_writer(path: &istr) -> buf_writer {
374375

375376
// FIXME it would be great if this could be a const
376377
fn stdout() -> writer { ret new_writer(fd_buf_writer(1, option::none)); }
378+
fn stderr() -> writer { ret new_writer(fd_buf_writer(2, option::none)); }
377379

378380
type str_writer =
379381
obj {

src/rt/rust_builtin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ rust_file_is_dir(rust_task *task, rust_str *path) {
534534

535535
extern "C" CDECL FILE* rust_get_stdin() {return stdin;}
536536
extern "C" CDECL FILE* rust_get_stdout() {return stdout;}
537+
extern "C" CDECL FILE* rust_get_stderr() {return stderr;}
537538

538539
extern "C" CDECL int
539540
rust_ptr_eq(rust_task *task, type_desc *t, rust_box *a, rust_box *b) {

src/rt/rustrt.def.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ rust_dirent_filename
4848
rust_file_is_dir
4949
rust_get_stdin
5050
rust_get_stdout
51+
rust_get_stderr
5152
rust_istr_push
5253
rust_list_files
5354
rust_process_wait

0 commit comments

Comments
 (0)