Skip to content

Commit 8d25719

Browse files
committed
Change to put error messages into stderr
1 parent 6522337 commit 8d25719

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/exa.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern crate zoneinfo_compiled;
2020
#[macro_use] extern crate lazy_static;
2121

2222
use std::ffi::OsStr;
23-
use std::io::{Write, Result as IOResult};
23+
use std::io::{stderr, Write, Result as IOResult};
2424
use std::path::{Component, Path};
2525

2626
use fs::{Dir, File};
@@ -72,13 +72,13 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
7272
for file_name in self.args.iter() {
7373
match File::from_path(Path::new(&file_name), None) {
7474
Err(e) => {
75-
try!(writeln!(self.writer, "{}: {}", file_name, e));
75+
try!(writeln!(stderr(), "{}: {}", file_name, e));
7676
},
7777
Ok(f) => {
7878
if f.is_directory() && !self.options.dir_action.treat_dirs_as_files() {
7979
match f.to_dir(self.options.should_scan_for_git()) {
8080
Ok(d) => dirs.push(d),
81-
Err(e) => try!(writeln!(self.writer, "{}: {}", file_name, e)),
81+
Err(e) => try!(writeln!(stderr(), "{}: {}", file_name, e)),
8282
}
8383
}
8484
else {
@@ -122,7 +122,7 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
122122
for file in dir.files() {
123123
match file {
124124
Ok(file) => children.push(file),
125-
Err((path, e)) => try!(writeln!(self.writer, "[{}: {}]", path.display(), e)),
125+
Err((path, e)) => try!(writeln!(stderr(), "[{}: {}]", path.display(), e)),
126126
}
127127
};
128128

@@ -137,7 +137,7 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
137137
for child_dir in children.iter().filter(|f| f.is_directory()) {
138138
match child_dir.to_dir(false) {
139139
Ok(d) => child_dirs.push(d),
140-
Err(e) => try!(writeln!(self.writer, "{}: {}", child_dir.path.display(), e)),
140+
Err(e) => try!(writeln!(stderr(), "{}: {}", child_dir.path.display(), e)),
141141
}
142142
}
143143

0 commit comments

Comments
 (0)