浏览代码

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