From 4df7b36dfc265dfa78a7a4e38a66f43fb4e03b87 Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 28 May 2021 17:18:34 +0200 Subject: [PATCH] Print matches while still searching. Previously we printed the matches at the end. --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 4a49953..46767fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -204,6 +204,14 @@ int main(int argc, char *argv[]) } futurepool.emplace_back( std::async(std::launch::async, search_file, filepath)); + + if (!matches_all.empty()) + { + output::print_matches(matches_all[0], opts, + input_files.size() == 1); + std::lock_guard guard(mutex_matches_all); + matches_all.erase(matches_all.begin()); + } } futures_cleanup(true);