MCPcopy Create free account
hub / github.com/pydata/numexpr / run_and_get_stdout

Function run_and_get_stdout

numexpr3/cpuinfo.py:238–252  ·  view source on GitHub ↗
(command, pipe_command=None)

Source from the content-addressed store, hash-verified

236 return {}
237
238def run_and_get_stdout(command, pipe_command=None):
239 if not pipe_command:
240 p1 = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
241 output = p1.communicate()[0]
242 if not PY2:
243 output = output.decode(encoding='UTF-8')
244 return p1.returncode, output
245 else:
246 p1 = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
247 p2 = subprocess.Popen(pipe_command, stdin=p1.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
248 p1.stdout.close()
249 output = p2.communicate()[0]
250 if not PY2:
251 output = output.decode(encoding='UTF-8')
252 return p2.returncode, output
253
254
255def program_paths(program_name):

Callers 12

cat_proc_cpuinfoMethod · 0.85
cpufreq_infoMethod · 0.85
dmesg_aMethod · 0.85
isainfo_vbMethod · 0.85
kstat_m_cpu_infoMethod · 0.85
sysinfo_cpuMethod · 0.85
lscpuMethod · 0.85
ibm_pa_featuresMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…