simplify regex
read all data based on length of output
remove redundant file close
don't use shell
use local vars and quotes
use errno module and raise exception if bad command received
fix errno bug, use variables for range exception string
use quotes
rm -f won't return 0 exit code if called on non existant file
redirect pushd/popd stdout to dev/null and use run_or_fail when retrieving COMMIT
move subprocess exception handler closer to the related try block
Merge pull request #3 from malini/review

review related fixes