//
if env.config["run_mode"] == "interactive":
// need to catch output and send to python output, which will in trun be hijacked by SoS notebook
p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
out, err = p.communicate()
if out and env.verbosity > 1:
sys.stdout.write(out.decode())
if err and env.verbosity > 0:
sys.stderr.write(err.decode())
ret = p.returncode
sys.stdout.flush()
sys.stderr.flush()
elif "__std_out__" in env.sos_dict and "__std_err__" in env.sos_dict:
if env.verbosity > 1: