Skip to content

Commit

Permalink
Better handle errors when deleting an existing directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hussainweb committed Jun 15, 2020
1 parent 1e5278e commit a3a7267
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion axltempl/drupal.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ def main(
)
return 2
util.write_warning(f'Removing "{directory}" directory...')
shutil.rmtree(directory, True)
try:
shutil.rmtree(directory)
except OSError as err:
util.write_error(f'Failed deleting the "{directory}" directory')
util.write_error(str(err))
return 2

os.mkdir(directory)
os.chdir(directory)
Expand Down

0 comments on commit a3a7267

Please sign in to comment.