MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / run

Function run

Tools/CompileTesting/compiletesting.py:122–145  ·  view source on GitHub ↗
(command, outfile=None)

Source from the content-addressed store, hash-verified

120 print("Compile tests passed.")
121
122def run(command, outfile=None):
123
124 # shlex.split will preserve inner quotes
125 p0 = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
126
127 stdout0, stderr0 = p0.communicate()
128 rc = p0.returncode
129 p0.stdout.close()
130 p0.stderr.close()
131
132 if outfile:
133 try: cf = open(outfile, 'wb')
134 except IOError:
135 print("ERROR: unable to open file for writing")
136 else:
137 cf.write(stdout0)
138 cf.write(stderr0)
139 cf.close()
140 else:
141 print(" ", stdout0)
142 if stderr0:
143 print(" ", stderr0)
144
145 return rc
146
147if __name__ == "__main__":
148 compiletesting(sys.argv[1:])

Callers 1

compiletestingFunction · 0.70

Calls 2

communicateMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected