浏览代码

Remove possibility to use eval

This seems too hard to support safely, and the advantages are minimal as
most cases will be possile to solve by wrapping the builtin into a
function.
Alois Mahdal 10 年前
父节点
当前提交
6a98fb4044
共有 1 个文件被更改,包括 2 次插入11 次删除
  1. 2
    11
      src/include/recon.sh

+ 2
- 11
src/include/recon.sh 查看文件

187
     #     wait_until -t 90 -d 30 my_expensive_command
187
     #     wait_until -t 90 -d 30 my_expensive_command
188
     #     wait_until -x 7 command_that_should_exit_with_7
188
     #     wait_until -x 7 command_that_should_exit_with_7
189
     #     wait_until -X "-lt 7" command_that_should_exit_with_less_than_7
189
     #     wait_until -X "-lt 7" command_that_should_exit_with_less_than_7
190
-    #     wait_until -e some_bash_builtin
191
     #
190
     #
192
     # Note that polling happens synchronously so if your
191
     # Note that polling happens synchronously so if your
193
     # command blocks for more than specified delay, freequency
192
     # command blocks for more than specified delay, freequency
197
     #
196
     #
198
     local timeout=10
197
     local timeout=10
199
     local delay=1
198
     local delay=1
200
-    local use_eval=false
201
     local es_test="-eq 0"
199
     local es_test="-eq 0"
202
     while true; do case "$1" in
200
     while true; do case "$1" in
203
         -x) es_test="-eq $2"; shift;    ;;
201
         -x) es_test="-eq $2"; shift;    ;;
204
         -X) es_test="$2"; shift;        ;;
202
         -X) es_test="$2"; shift;        ;;
205
-        -e) use_eval=true; shift; break ;;
206
         -d) delay="$2"; shift 2;        ;;
203
         -d) delay="$2"; shift 2;        ;;
207
         -t) timeout="$2"; shift 2;      ;;
204
         -t) timeout="$2"; shift 2;      ;;
208
         --) shift 1; break;             ;;
205
         --) shift 1; break;             ;;
218
         local elapsed=$(($now - $start))
215
         local elapsed=$(($now - $start))
219
         local es=0
216
         local es=0
220
         debug "\$@='$@'"
217
         debug "\$@='$@'"
221
-        if $use_eval;
222
-        then
223
-            eval $@;
224
-            es=$?
225
-        else
226
-            $@;
227
-            es=$?
228
-        fi
218
+        $@;
219
+        es=$?
229
         debug -v es
220
         debug -v es
230
         if [ $es $es_test ];
221
         if [ $es $es_test ];
231
         then
222
         then