Skip to content

Commit

Permalink
Merge pull request #116 from buildingSMART/IVS-220_catch_segfault
Browse files Browse the repository at this point in the history
IVS-220_catch_segfaults
  • Loading branch information
civilx64 authored Nov 9, 2024
2 parents 551c381 + fd6b6b0 commit bb1f1cb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/apps/ifc_validation/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,17 @@ def parse_info_subtask(self, prev_result, id, file_name, *args, **kwargs):

task.mark_as_initiated()

# try to open IFC file (catch segfaults)
try:
code = "import ifcopenshell; ifcopenshell.open('" + file_path + "')"
check_program = [sys.executable, '-c', code, file_path]
logger.debug(f'Command for {self.__qualname__}: {" ".join(check_program)}')
subprocess.run(check_program, check=True)

except subprocess.CalledProcessError as err:
task.mark_as_failed(err)
raise

# retrieve IFC info
try:
task.set_process_details(None, f"(module) ifcopenshell.open() for file '{file_path}')")
Expand Down

0 comments on commit bb1f1cb

Please sign in to comment.