Implemented BaseCommand.iter_lines

Refactored some things around run_proc so that they can be reused and added a couple of unittests.