|
@@ -6,11 +6,12 @@
|
6
|
6
|
TMPDIR=`mktemp -d`
|
7
|
7
|
|
8
|
8
|
# Reformat a single file to tmp/
|
9
|
|
-uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out
|
10
|
|
-
|
11
|
|
-# Replace the original file
|
12
|
|
-cp "$TMPDIR/uncrustify.out" "$1"
|
|
9
|
+if uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out ; then
|
|
10
|
+ cp "$TMPDIR/uncrustify.out" "$1" ; # Replace the original file
|
|
11
|
+else
|
|
12
|
+ echo "Something went wrong with uncrustify."
|
|
13
|
+fi
|
13
|
14
|
|
14
|
15
|
# Clean up, deliberately
|
15
|
|
-rm "$TMPDIR/uncrustify.out"
|
|
16
|
+[[ -f "$TMPDIR/uncrustify.out" ]] && rm "$TMPDIR/uncrustify.out"
|
16
|
17
|
rmdir "$TMPDIR"
|