Pull p.communicate call out of branch
Pass args to Popen as kwargs, and open file in update mode to avoid reopening
Fix bug where command isn't printed until after output

'print' was previously used to print the command being executed by _exec.
Due to buffering, the printed command wasn't written to the output file until
after the command was executed. Changed to an explicit write() and flush()
of the file so that it is written before the program output
Typo- stdin should set stdin command option
Add file offset to _exec file operations

When appending output to a file, _exec now takes into account the previous
size of the file and uses this to only consider data appended on this run
when reading process output into the function return value
Merge pull request #1 from leeping/_exec

 exec refactor