From f587a4e3f30324789a50acc107047e430be1a172 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 29 Mar 2021 20:00:57 -0500 Subject: [PATCH] Improve uncrust script --- buildroot/bin/uncrust | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/buildroot/bin/uncrust b/buildroot/bin/uncrust index 9893b5c380..7898f73c8c 100755 --- a/buildroot/bin/uncrust +++ b/buildroot/bin/uncrust @@ -6,11 +6,12 @@ TMPDIR=`mktemp -d` # Reformat a single file to tmp/ -uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out - -# Replace the original file -cp "$TMPDIR/uncrustify.out" "$1" +if uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out ; then + cp "$TMPDIR/uncrustify.out" "$1" ; # Replace the original file +else + echo "Something went wrong with uncrustify." +fi # Clean up, deliberately -rm "$TMPDIR/uncrustify.out" +[[ -f "$TMPDIR/uncrustify.out" ]] && rm "$TMPDIR/uncrustify.out" rmdir "$TMPDIR"