Skip to content

Commit fafc9b8

Browse files
committed
Improve export clean failure message
1 parent 998111d commit fafc9b8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/project.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
ROOT = abspath(join(dirname(__file__), ".."))
77
sys.path.insert(0, ROOT)
88

9-
from subprocess import Popen
9+
from subprocess import check_call, CalledProcessError
1010
from shutil import move, rmtree
1111
from argparse import ArgumentParser
1212
from os.path import normpath, realpath
@@ -200,7 +200,12 @@ def main():
200200

201201
# Clean Export Directory
202202
if options.clean:
203-
Popen(["git", "clean", "-fe", "mbed-os"]).wait()
203+
try:
204+
check_call(["git", "clean", "-fe", "mbed-os"])
205+
except CalledProcessError:
206+
print "Warning: your directory was not cleaned because it was not"\
207+
" recognized as a git repo or you do not have git installed in"\
208+
" your path."
204209

205210
for mcu in options.mcu:
206211
zip_proj = not bool(options.source_dir)

0 commit comments

Comments
 (0)