-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish PlainStatusBackend #636
Merged
pkgw
merged 11 commits into
tectonic-typesetting:master
from
ralismark:plain-status-backend
Sep 11, 2020
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8cf10ab
implement PlainStatusBackend
Mrmaxmeier d18a619
driver: use dynamic dispatch for StatusBackend
Mrmaxmeier 39f680e
cli: implement --color={always,auto,never}
Mrmaxmeier cd90bc2
rename --color to --cli-color
Mrmaxmeier d0ec0f6
Rework dump_to_stderr
6c06176
Clean up atty dependency entry
af12d36
Respect chatter setting
2584c12
Rename --cli-color to --color
bf9dc3f
Test color=never and color=auto
765db4e
Attempt to gather coverage from executable tests
pkgw 0dbaf2a
dist/azure-coverage.yml: remove now-unneeded command and more fail-pa…
pkgw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
use std::fmt::Arguments; | ||
|
||
use super::{ChatterLevel, MessageKind, StatusBackend}; | ||
use crate::errors::Error; | ||
use std::io::{self, Write}; | ||
|
||
pub struct PlainStatusBackend { | ||
chatter: ChatterLevel, | ||
} | ||
|
||
impl PlainStatusBackend { | ||
pub fn new(chatter: ChatterLevel) -> Self { | ||
PlainStatusBackend { chatter } | ||
} | ||
} | ||
|
||
impl StatusBackend for PlainStatusBackend { | ||
fn report(&mut self, kind: MessageKind, args: Arguments, err: Option<&Error>) { | ||
if kind == MessageKind::Note && self.chatter <= ChatterLevel::Minimal { | ||
return; | ||
} | ||
|
||
let prefix = match kind { | ||
MessageKind::Note => "note:", | ||
MessageKind::Warning => "warning:", | ||
MessageKind::Error => "error:", | ||
}; | ||
if kind == MessageKind::Note { | ||
println!("{} {}", prefix, args); | ||
} else { | ||
eprintln!("{} {}", prefix, args); | ||
} | ||
if let Some(e) = err { | ||
for item in e.iter() { | ||
eprintln!("caused by: {}", item); | ||
} | ||
if let Some(backtrace) = e.backtrace() { | ||
eprintln!("debugging: backtrace follows:"); | ||
eprintln!("{:?}", backtrace); | ||
} | ||
} | ||
} | ||
|
||
fn note_highlighted(&mut self, before: &str, highlighted: &str, after: &str) { | ||
if self.chatter > ChatterLevel::Minimal { | ||
self.report( | ||
MessageKind::Note, | ||
format_args!("{}{}{}", before, highlighted, after), | ||
None, | ||
); | ||
} | ||
} | ||
|
||
fn dump_error_logs(&mut self, output: &[u8]) { | ||
eprintln!( | ||
"===============================================================================" | ||
); | ||
|
||
io::stderr() | ||
.write_all(output) | ||
.expect("write to stderr failed"); | ||
|
||
eprintln!( | ||
"===============================================================================" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh ... I was confused by why you new tests didn't seem to have any coverage, but here it is disabled in the coverage run!
Looking in the history, it is not clear to me why these tests get disabled during the code-coverage tests. @Mrmaxmeier I think you added these tests originally ... do you remember why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vaguely remember something about the coverage tracking not working for end-to-end tests that spawn a new
tectonic
process. Not sure if that's still an issue though.