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

Print error rather than exit when encountering permission denied #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

horgh
Copy link

@horgh horgh commented Oct 9, 2017

Previously if we encountered a file we could not read for permission
reasons, we'd exit immediately. This meant that you either had to stop
and fix the permissions or tell pt to ignore the file.

Now we print the error out which is similar to what grep does.

Rather than using log.Printf which could have issues writing at the same
time as printing the matches, this uses the same printer. It also adds a
new colour code for errors so that they are more noticable when running
with coloured output.

This should resolve #145.

Previously if we encountered a file we could not read for permission
reasons, we'd exit immediately. This meant that you either had to stop
and fix the permissions or tell pt to ignore the file.

Now we print the error out which is similar to what grep does.

Rather than using log.Printf which could have issues writing at the same
time as printing the matches, this uses the same printer. It also adds a
new colour code for errors so that they are more noticable when running
with coloured output.

This should resolve monochromegane#145.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent premature bailout when encountering permission-dened files/dirs
1 participant