for k, v in kw.items():
del os.environ[k]
if p.returncode != 0:
raise RuntimeError(out)
return out
def cd(dir):
print("+cd %s" % dir)
After Change
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
out = out.decode("utf-8").strip()
err = err.decode("utf-8").strip()
for k, v in kw.items():
del os.environ[k]
if p.returncode != 0:
raise RuntimeError("STDOUT:\n\n" + out + "\n\nSTDERR:\n\n" + err)