Skip to content

Commit

Permalink
workaround shee=true
Browse files Browse the repository at this point in the history
  • Loading branch information
GBenedett committed Jun 12, 2024
1 parent 0789a38 commit e65ecf5
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions ceasiompy/PyAVL/avlrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,27 @@ def run_avl(cpacs_path, wkdir):
ref_density=density,
g_acceleration=g,
)
run_avl_command = ["xvfb-run", "avl"]
with open(command_path, "r") as command_file:
subprocess.run(
run_avl_command,
stdin=command_file,
cwd=case_dir_path,
start_new_session=False,
check=True, # This will raise an exception if the command fails
)
subprocess.run(["xvfb-run", "avl"], stdin=open(str(command_path), "r"), cwd=case_dir_path)

if save_fig:
conversion_command = ["ps2pdf", "plot.ps", "plot.pdf"]
subprocess.run(
conversion_command, cwd=case_dir_path, start_new_session=False, check=True
)
file_path = "command.txt"

command_str = " ".join(conversion_command)

with open(file_path, "w") as file:
file.write(command_str)
subprocess.call(conversion_command, cwd=case_dir_path, start_new_session=False)

delete_ps = ["rm", "plot.ps"]
subprocess.run(delete_ps, cwd=case_dir_path, start_new_session=False, check=True)
file_path_2 = "delete_command.txt"

command_str_2 = " ".join(delete_ps)

with open(file_path_2, "w") as file:
file.write(command_str_2)

subprocess.call(delete_ps, cwd=case_dir_path, start_new_session=False)


# =================================================================================================
Expand Down

0 comments on commit e65ecf5

Please sign in to comment.