Procházet zdrojové kódy

Improve uncrust script

Scott Lahteine před 3 roky
rodič
revize
f587a4e3f3
1 změnil soubory, kde provedl 6 přidání a 5 odebrání
  1. 6
    5
      buildroot/bin/uncrust

+ 6
- 5
buildroot/bin/uncrust Zobrazit soubor

@@ -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"

Loading…
Zrušit
Uložit