Skip to content

Commit

Permalink
Make sure we send a return code when the command fails
Browse files Browse the repository at this point in the history
Click does not let the return code pass through. So, we explicitly use sys.exit(). pallets/click#747
  • Loading branch information
hussainweb committed Jun 15, 2020
1 parent a3a7267 commit 2610330
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions axltempl/drupal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import pkgutil
import shutil
import sys

import click

Expand Down Expand Up @@ -99,14 +100,14 @@ def main(
f'The "{directory}" directory already exists.'
+ "Please delete it before running or use the -f option."
)
return 2
sys.exit(2)
util.write_warning(f'Removing "{directory}" directory...')
try:
shutil.rmtree(directory)
except OSError as err:
util.write_error(f'Failed deleting the "{directory}" directory')
util.write_error(str(err))
return 2
sys.exit(2)

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

0 comments on commit 2610330

Please sign in to comment.