Skip to content

Commit

Permalink
Raise error if a specified input file is not readable
Browse files Browse the repository at this point in the history
  • Loading branch information
mooz committed Mar 15, 2015
1 parent 79d0f3c commit 4738480
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions percol/cli.py
Expand Up @@ -217,6 +217,10 @@ def open_tty(ttyname):

filename = args[0] if len(args) > 0 else None

if filename and not os.access(filename, os.R_OK):
exit_program(error_message("Cannot read a file '" + filename + "'"),
show_help=False)

if filename is None and sys.stdin.isatty():
tty_f.write(INSTRUCTION_TEXT)
exit_program(show_help = False)
Expand Down

0 comments on commit 4738480

Please sign in to comment.