@@ -29,7 +29,7 @@ MY_DATE="2022-12-17"
29
29
MY_URL=" https://github.com/devilbox/watcherd"
30
30
MY_AUTHOR=
" cytopia <[email protected] >"
31
31
MY_GPGKEY=" 0xA02C56F0"
32
- MY_VERSION=" 1.0.3 "
32
+ MY_VERSION=" 1.0.4 "
33
33
MY_LICENSE=" MIT"
34
34
35
35
# Default settings
@@ -130,17 +130,14 @@ function action() {
130
130
action=" ${action//% p/ ${directory} } "
131
131
action=" ${action//% n/ ${name} } "
132
132
133
- if OUTPUT= " $( eval " ${action} " 2>&1 ) " ; then
133
+ if eval " ${action} " ; then
134
134
if [ " ${verbose} " -gt " 0" ]; then
135
135
printf " %s: [%s] [OK] %s succeeded: %s\\ n" " ${MY_NAME} " " $( date ' +%Y-%m-%d %H:%M:%S' ) " " ${info} " " ${directory} "
136
136
fi
137
137
return 0
138
138
else
139
139
printf " %s: [%s] [ERR] %s failed: %s\\ n" " ${MY_NAME} " " $( date ' +%Y-%m-%d %H:%M:%S' ) " " ${info} " " ${directory} " >&2
140
140
printf " %s: [%s] [ERR] %s failed: %s\\ n" " ${MY_NAME} " " $( date ' +%Y-%m-%d %H:%M:%S' ) " " ${info} " " ${action} " >&2
141
- if [ -n " ${OUTPUT} " ]; then
142
- printf " %s: [%s] [ERR] %s\\ n" " ${MY_NAME} " " $( date ' +%Y-%m-%d %H:%M:%S' ) " " ${OUTPUT} " >&2
143
- fi
144
141
return 1
145
142
fi
146
143
}
@@ -153,16 +150,13 @@ function trigger() {
153
150
# Only run trigger when command has been specified (not empty)
154
151
if [ -n " ${action} " ]; then
155
152
if [ " ${changes} " -eq " 1" ]; then
156
- if OUTPUT= " $( eval " ${action} " 2>&1 ) " ; then
153
+ if eval " ${action} " ; then
157
154
if [ " ${verbose} " -gt " 0" ]; then
158
155
printf " %s: [%s] [OK] %s succeeded: %s\\ n" " ${MY_NAME} " " $( date ' +%Y-%m-%d %H:%M:%S' ) " " TRIGGER" " ${action} "
159
156
fi
160
157
return 0
161
158
else
162
159
printf " %s: [%s] [ERR] %s failed: %s\\ n" " ${MY_NAME} " " $( date ' +%Y-%m-%d %H:%M:%S' ) " " TRIGGER" " ${action} " >&2
163
- if [ -n " ${OUTPUT} " ]; then
164
- printf " %s: [%s] [ERR] %s\\ n" " ${MY_NAME} " " $( date ' +%Y-%m-%d %H:%M:%S' ) " " ${OUTPUT} " >&2
165
- fi
166
160
# Also return 0 here in order to not abort the loop
167
161
return 0
168
162
fi
0 commit comments