Fix usage of Popen.wait().  This is liable to deadlock if used with subprocess.PIPE and it was used like that all over the place.

I've created new wrapper that will hopefully avoid this broken usage.
Add documenation for the new functions.
Merge pull request #1793 from abergeron/fix_popen

Fix usage of Popen.wait().