Commit a7dc7667 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl

Two little errors in manual_cpp

- execvp needs the programs name also as first argument in the argument
  list
- len(files) == 1 (i.e. the normal case) was omitted in the last second
  when the error handling was improved
parent 7e1dea02
......@@ -19,8 +19,11 @@ def check_call_redirect(args, filename=None, **kwargs):
if os.getenv("V") == "1":
print(" ".join(args), ">", filename)
with open(filename, "wb") as fd:
return subprocess.check_call(args, stdout=fd, **kwargs)
try:
return subprocess.check_call(args, stdout=fd, **kwargs)
except subprocess.CalledProcessError as e:
os.remove(filename)
raise SystemExit(e.returncode)
args = sys.argv[1:]
cpp_args = filter(cpp_arg, args)
......@@ -31,7 +34,9 @@ if len(files) > 1:
raise Exception("Specify exactly one .F90 file")
elif len(files) == 0:
# No .F90 file specified, execute program as-is
os.execvp(args[0], args[1:])
os.execvp(args[0], args[0:])
elif len(files) == 1:
file, = files
tmp_filename = "manually_preprocessed_" + file.replace("/", "__")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment