Skip to content

Commit 46ec087

Browse files
authored
Fix running command (#12)
1 parent a6624fe commit 46ec087

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

files-watcher/files-watcher

+10-3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ report_done() {
9090
[[ $# > 0 ]] && echo "${FCG}$@${NC}" || echo "${FCG}✓ Done${NC}"
9191
}
9292

93+
run_command() {
94+
local previous_ifs=${IFS}
95+
IFS=' '
96+
command $@
97+
IFS=${previous_ifs}
98+
}
99+
93100
main() {
94101
watch_branches=$(git config --default master --get files-watcher.watch-branches)
95102
default_mode=$(git config --default prompt --get files-watcher.mode)
@@ -141,16 +148,16 @@ main() {
141148
for command in ${commands} ; do
142149
case "${mode}" in
143150
"auto" )
144-
command ${command}
151+
run_command "${command}"
145152
;;
146153
"prompt" )
147154
if prompt "Do you like to run '${command}'?"; then
148-
command ${command}
155+
run_command "${command}"
149156
fi
150157
;;
151158
"confirm" )
152159
if confirm "Do you like to run '${command}'?"; then
153-
command ${command}
160+
run_command "${command}"
154161
fi
155162
;;
156163
* )

0 commit comments

Comments
 (0)