Skip to content

Commit 96c0514

Browse files
author
Tony Crisci
committed
send errors to stderr
1 parent 8526597 commit 96c0514

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mod writer;
2525
include!(concat!(env!("OUT_DIR"), "/data.rs"));
2626

2727
fn exit_error(msg: &str) {
28-
println!("{}", msg);
28+
writeln!(&mut std::io::stderr(), "{}", msg);
2929
process::exit(1);
3030

3131
}
@@ -71,7 +71,7 @@ fn validate_config(path: &String) -> bool {
7171
.unwrap();
7272

7373
if !status.success() {
74-
println!("Could not find i3 binary in the system PATH to validate the config before parsing");
74+
writeln!(&mut std::io::stderr(), "Could not find i3 binary in the system PATH to validate the config before parsing");
7575
return false
7676
}
7777

@@ -203,7 +203,7 @@ fn main() {
203203
}
204204

205205
if !validate_config(&config) {
206-
println!("Could not validate config at {}. Use `i3 -C -c {}` to see validation errors.", config, config);
206+
writeln!(&mut std::io::stderr(), "Could not validate config at {}. Use `i3 -C -c {}` to see validation errors.", config, config);
207207
process::exit(1);
208208
}
209209

@@ -243,7 +243,7 @@ fn main() {
243243
let config = config.unwrap();
244244

245245
if !validate_config(&config) {
246-
println!("Could not validate config at {}. Use `i3 -C -c {}` to see validation errors.", config, config);
246+
writeln!(&mut std::io::stderr(), "Could not validate config at {}. Use `i3 -C -c {}` to see validation errors.", config, config);
247247
process::exit(1);
248248
}
249249

@@ -278,7 +278,7 @@ fn main() {
278278
// 1. write the new config in the tmp folder
279279
writer::write_config(&config, Some(&tmp_output), &theme);
280280
// 2. copy the config to the tmp folder
281-
println!("saving config at {} to {}", &config, &tmp_input);
281+
writeln!(&mut std::io::stderr(), "saving config at {} to {}", &config, &tmp_input);
282282
fs::copy(&config, &tmp_input).unwrap();
283283
// 3. copy the new config to the config location
284284
fs::copy(&tmp_output, output).unwrap();

0 commit comments

Comments
 (0)