Commit 93715a5 1 parent ddde2c7 commit 93715a5 Copy full SHA for 93715a5
File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -65,17 +65,25 @@ function main() {
65
65
# Look first for the m100-tokenize binary in same dir as this script.
66
66
PATH=$( dirname " $0 " ) :" $PATH "
67
67
68
+ local fail=0
68
69
if [[ " $dflag " ]]; then
69
70
echo " Decommenting and tokenizing '$f ' into '$g '"
70
71
jumps=$( m100-sanity " $f " | m100-jumps )
71
- m100-sanity " $f " | m100-decomment - " $g " ${jumps}
72
+ m100-sanity " $f " | m100-decomment - " $g " ${jumps} || fail=1
72
73
elif [[ " $cflag " ]]; then
73
74
echo " Decommenting, crunching, and tokenizing '$f ' into '$g '"
74
75
jumps=$( m100-sanity " $f " | m100-jumps )
75
- m100-sanity " $f " | m100-decomment - - ${jumps} | m100-crunch | m100-tokenize > $g
76
+ m100-sanity " $f " | m100-decomment - - ${jumps} | m100-crunch | m100-tokenize > $g || fail=1
76
77
else
77
78
echo " Tokenizing '$f ' into '$g '"
78
- m100-sanity " $f " | m100-tokenize > " $g "
79
+ m100-sanity " $f " | m100-tokenize > " $g " || fail=1
80
+ fi
81
+
82
+ echo fail is $fail
83
+ if [[ $fail -gt 0 ]]; then
84
+ echo " Error detected, removing '$g '" >&2
85
+ rm " $g "
86
+ exit 1
79
87
fi
80
88
}
81
89
@@ -102,7 +110,7 @@ function output_name() {
102
110
fi
103
111
104
112
# Don't overwrite existing files by default
105
- if [[ -e " $g " && " $g " -nt " $f " ]]; then
113
+ if [[ -s " $g " && " $g " -nt " $f " ]]; then
106
114
if ! tty -s; then
107
115
mv " $g " " $g ~" || return -1
108
116
else
You can’t perform that action at this time.
0 commit comments