Skip to content
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

Fix AnsiOutput write methods claiming zero bytes were written #31

Merged
merged 1 commit into from
Sep 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/modules/output/ansi_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,23 @@ pub struct AnsiOutput {

impl IStdout for AnsiOutput {
fn write_str(&self, string: &str) -> io::Result<usize> {
let out = &self.handle;
let mut handle = out.lock();
write!(handle, "{}", string)?;
handle.flush();
Ok(0)
let out = &self.handle;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason there are 5 spaces instead of 4 now.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the line 16 has only 3 spaces so it looks like 5.

Copy link
Member

@TimonPost TimonPost Sep 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing! You are right jojolepro I see that all functions are one space outlined. I'll clean it up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, the original function was missing one space of indentation, so I tried to fix it, but I think I missed line 16. My bad.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry already fixed it! But thanks for your pull request!

let mut handle = out.lock();
let amt = handle.write(string.as_bytes())?;
handle.flush()?;
Ok(amt)
}

fn write(&self, buf: &[u8]) -> io::Result<usize> {
let out = &self.handle;
let mut handle = out.lock();
handle.write(buf)?;
Ok(0)
handle.write(buf)
}

fn flush(&self) -> io::Result<()> {
let out = &self.handle;
let mut handle = out.lock();
handle.flush();
Ok(())
handle.flush()
}

fn as_any(&self) -> &Any {
Expand Down