015f0b12ab899d3c5ad19d75f1b8d25e8296faca,pysos/kernel.py,SoS_Kernel,handle_shell_command,#SoS_Kernel#Any#,907
Before Change
def handle_shell_command(self, cmd):
// interpolate command
try:
new_cmd = interpolate(cmd, sigil="${ }", local_dict=env.sos_dict._dict)
if new_cmd != cmd:
cmd = new_cmd
if not cmd.startswith("cd ") and not cmd.startswith("cd\t"):
self.send_response(self.iopub_socket, "stream",
{"name": "stdout", "text":
new_cmd.strip() + "\n//// -- End interpolated command --\n"})
except Exception as e:
self.send_response(self.iopub_socket, "stream",
{"name": "stdout", "text": "Failed to interpolate {}: {}\n".format(short_repr(cmd), e)})
self.send_response(self.iopub_socket, "stream",
{"name": "stdout", "text": str(e)})
return
with self.redirect_sos_io():
try:
p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
out, err = p.communicate()
After Change
def handle_shell_command(self, cmd):
// interpolate command
cmd = self._interpolate_option(cmd, quiet=False)
if cmd is None:
return
with self.redirect_sos_io():
try:
p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
out, err = p.communicate()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 19
Instances
Project Name: vatlab/SoS
Commit Name: 015f0b12ab899d3c5ad19d75f1b8d25e8296faca
Time: 2016-11-17
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name: SoS_Kernel
Method Name: handle_shell_command
Project Name: vatlab/SoS
Commit Name: 015f0b12ab899d3c5ad19d75f1b8d25e8296faca
Time: 2016-11-17
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name: SoS_Kernel
Method Name: handle_magic_cd
Project Name: vatlab/SoS
Commit Name: 015f0b12ab899d3c5ad19d75f1b8d25e8296faca
Time: 2016-11-17
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name: SoS_Kernel
Method Name: handle_shell_command
Project Name: vatlab/SoS
Commit Name: 015f0b12ab899d3c5ad19d75f1b8d25e8296faca
Time: 2016-11-17
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name: SoS_Kernel
Method Name: _do_execute