Skip to content

Fall back for systems without ack? #1

@thorsummoner

Description

@thorsummoner

My systems don't have ack installed by default; so I have two points:

  1. If ack is not installed and uincaught OSError is raised:
Traceback (most recent call last):
  File "/home/myuser/.local/bin/todo", line 16, in <module>
    todo.interactive(match_names=args.names, show_count=args.count)
  File "/home/myuser/.local/lib/python2.7/site-packages/todo/__init__.py", line 77, in interactive
    matches = get_todo_matches()
  File "/home/myuser/.local/lib/python2.7/site-packages/todo/__init__.py", line 66, in get_todo_matches
    matches = subprocess.check_output(['ack', '--with-filename', "TODO\\(.*\\)"])
  File "/usr/lib/python2.7/subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Suggest wrapping like 66 in a try catch to fail gracefully and alert the user that the programs depends on ack, link to readme w/e.

  1. Allow for alternate/fallback get_todo_matches modules so pure python implementations can be used to not have a hard dependency on ack when not available.

Cool tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions