Skip to content

Commit

Permalink
Conditionally use onexc for newer versions of python
Browse files Browse the repository at this point in the history
  • Loading branch information
favilo committed Mar 25, 2024
1 parent 66beee7 commit acf55e6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions esrally/rally.py
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,11 @@ def _trap(function, path, exc_info):
# fully destructive is fine, we only allow one Rally to run at a time and we will rely on the pip cache for download caching
logger.info("Cleaning track dependency directory [%s]...", paths.libs())

# pylint: disable=deprecated-argument
shutil.rmtree(paths.libs(), onerror=_trap)
if sys.version.major == 3 and sys.version.minor <= 11:
# pylint: disable=deprecated-argument
shutil.rmtree(paths.libs(), onerror=_trap)
else:
shutil.rmtree(paths.libs(), onexc=_trap)

result = dispatch_sub_command(arg_parser, args, cfg)

Expand Down

0 comments on commit acf55e6

Please sign in to comment.