display stdout & stderr in realtime

Also, subprocess.getstatusoutput works only for python 3, this version is compatible with both.