MCPcopy
hub / github.com/pyinstaller/pyinstaller / exec_command

Method exec_command

bootloader/waflib/Tools/waf_unit_test.py:142–170  ·  view source on GitHub ↗
(self, cmd, **kw)

Source from the content-addressed store, hash-verified

140 return self.exec_command(self.ut_exec)
141
142 def exec_command(self, cmd, **kw):
143 self.generator.bld.log_command(cmd, kw)
144 if getattr(Options.options, 'dump_test_scripts', False):
145 script_code = SCRIPT_TEMPLATE % {
146 'python': sys.executable,
147 'env': self.get_test_env(),
148 'cwd': self.get_cwd().abspath(),
149 'cmd': cmd
150 }
151 script_file = self.inputs[0].abspath() + '_run.py'
152 Utils.writef(script_file, script_code, encoding='utf-8')
153 os.chmod(script_file, Utils.O755)
154 if Logs.verbose > 1:
155 Logs.info('Test debug file written as %r' % script_file)
156 proc = Utils.subprocess.Popen(
157 cmd,
158 cwd=self.get_cwd().abspath(),
159 env=self.get_test_env(),
160 stderr=Utils.subprocess.PIPE,
161 stdout=Utils.subprocess.PIPE,
162 shell=isinstance(cmd, str)
163 )
164 (stdout, stderr) = proc.communicate()
165 self.waf_unit_test_results = tup = (self.inputs[0].abspath(), proc.returncode, stdout, stderr)
166 testlock.acquire()
167 try:
168 return self.generator.add_test_results(tup)
169 finally:
170 testlock.release()
171
172 def get_cwd(self):
173 return getattr(self.generator, 'ut_cwd', self.inputs[0].parent)

Callers 1

runMethod · 0.95

Calls 8

get_test_envMethod · 0.95
get_cwdMethod · 0.95
log_commandMethod · 0.80
abspathMethod · 0.80
chmodMethod · 0.80
infoMethod · 0.80
acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected