bc823da8c38eae03a311d0ba0627b23b84939b56,src/sos/actions.py,SoS_ExecuteScript,run,#SoS_ExecuteScript#,205

Before Change


                //
                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:

After Change


                if env.config["run_mode"] == "interactive":
                    // need to catch output and send to python output, which will in trun be hijacked by SoS notebook
                    import pexpect
                    try:
                        if isinstance(cmd, str):
                            child = pexpect.spawn(cmd, timeout=None)
                        else:
                            child = pexpect.spawn(subprocess.list2cmdline(cmd), timeout=None)
                        while True:
                            try:
                                child.expect("\n")
                                if env.verbosity > 0:
                                    sys.stdout.write(child.before.decode() + "\n")
                            except pexpect.EOF:
                                break
                    except Exception as e:
                        sys.stderr.write(str(e))
                    // NOTE:
                    // because of the use of pexpect, we do not know the
                    // return code of the process at all.
                    ret = 0
                elif "__std_out__" in env.sos_dict and "__std_err__" in env.sos_dict:
                    if env.verbosity > 1:
                        with open(env.sos_dict["__std_out__"], "ab") as so, open(env.sos_dict["__std_err__"], "ab") as se:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: vatlab/SoS
Commit Name: bc823da8c38eae03a311d0ba0627b23b84939b56
Time: 2017-07-30
Author: ben.bog@gmail.com
File Name: src/sos/actions.py
Class Name: SoS_ExecuteScript
Method Name: run


Project Name: pysb/pysb
Commit Name: d39d3272220da5bcb0c43985e6c1e3903dac2bf5
Time: 2011-08-07
Author: jmuhlich@bitflood.org
File Name: setup.py
Class Name:
Method Name: main


Project Name: studioml/studio
Commit Name: 580a99bfb656a6f6b99133c9986252e619713fe1
Time: 2017-08-15
Author: peter.zhokhov@Peters-MBP.geneticfinance.com
File Name: studio/model.py
Class Name: FirebaseProvider
Method Name: _get_experiment_logtail