You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ga...@apache.org on 2020/05/18 17:36:17 UTC

[flink] 01/03: [FLINK-17687][tests] Enable listing files recursively by pattern

This is an automated email from the ASF dual-hosted git repository.

gary pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit be8c02e397943d668c4ff64e4c491a560136e2e1
Author: Gary Yao <ga...@apache.org>
AuthorDate: Thu May 14 17:10:35 2020 +0200

    [FLINK-17687][tests] Enable listing files recursively by pattern
---
 flink-jepsen/src/jepsen/flink/utils.clj | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/flink-jepsen/src/jepsen/flink/utils.clj b/flink-jepsen/src/jepsen/flink/utils.clj
index 5d8e712..39ee36c 100644
--- a/flink-jepsen/src/jepsen/flink/utils.clj
+++ b/flink-jepsen/src/jepsen/flink/utils.clj
@@ -58,16 +58,17 @@
 (defn find-files!
   "Lists files recursively given a directory. If the directory does not exist, an empty collection
   is returned."
-  [dir]
+  ([dir] (find-files! dir "*"))
+  ([dir name]
   (let [files (try
-                (c/exec :find dir :-type :f)
+                (c/exec :find dir :-type :f :-name (c/lit (str "\"" name "\"")))
                 (catch Exception e
                   (if (.contains (.getMessage e) "No such file or directory")
                     ""
                     (throw e))))]
     (->>
       (clojure.string/split files #"\n")
-      (remove clojure.string/blank?))))
+      (remove clojure.string/blank?)))))
 
 ;;; runit process supervisor (http://smarden.org/runit/)