MCPcopy Create free account
hub / github.com/WebAssembly/wabt / _RunWithArgsInternal

Method _RunWithArgsInternal

test/utils.py:53–82  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

51 return None if forward else subprocess.PIPE
52
53 def _RunWithArgsInternal(self, *args, **kwargs):
54 cmd = [self.exe] + list(args) + self.after_args
55 cmd_str = shlex.join(cmd)
56 if self.verbose:
57 print(cmd_str)
58
59 if self.error_cmdline:
60 err_cmd_str = cmd_str
61 else:
62 err_cmd_str = self.basename
63
64 stdout = ''
65 stderr = ''
66 error = None
67 try:
68 process = subprocess.run(cmd, check=False, text=True,
69 stdout=self.stdout_handle,
70 stderr=self.stderr_handle, **kwargs)
71 stdout = process.stdout
72 stderr = process.stderr
73 if process.returncode < 0:
74 # Terminated by signal
75 signame = SIGNAMES.get(-process.returncode, '<unknown>')
76 error = Error('Signal raised running "%s": %s\n%s' % (err_cmd_str,
77 signame, stderr))
78 elif process.returncode > 0:
79 error = Error('Error running "%s" (%d):\n%s\n%s' % (err_cmd_str, process.returncode, stdout, stderr))
80 except OSError as e:
81 error = Error('Error running "%s": %s' % (err_cmd_str, str(e)))
82 return stdout, stderr, error
83
84 def RunWithArgsForStdout(self, *args, **kwargs):
85 stdout, stderr, error = self._RunWithArgsInternal(*args, **kwargs)

Callers 2

RunWithArgsForStdoutMethod · 0.95
RunWithArgsMethod · 0.95

Calls 5

printFunction · 0.85
joinMethod · 0.80
runMethod · 0.80
ErrorClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected