From 26c84bf4976065ba83d4be59729f77c2be975a6a Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Sat, 13 Aug 2022 00:14:36 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20add=20done=20msg=20to=20follow?= =?UTF-8?q?=5Fprocess=5Flog=5Fwidget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/follow_process_log.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/follow_process_log.cpp b/src/follow_process_log.cpp index d245a13..86f0e79 100644 --- a/src/follow_process_log.cpp +++ b/src/follow_process_log.cpp @@ -20,15 +20,22 @@ namespace tui::detail { void follow_process_log_widget(const std::vector& vec, Decorator box_size) noexcept { using namespace std::chrono_literals; + std::vector cmd_args(vec.begin(), vec.end()); + const auto cmd_args_size = cmd_args.size(); + if (cmd_args_size > 2) { + const auto& second_arg = cmd_args[1]; + if (second_arg == "-c") { + auto& end_arg = cmd_args.back(); + end_arg += " ; echo -e \"\n----------DONE----------\n\""; + } + } + bool running{true}; std::string process_log{}; subprocess_s child{}; auto execute_thread = [&]() { while (running) { - utils::exec_follow(vec, process_log, running, child); - /*if (child.child == 0) { - process_log += "\n----------DONE----------"; - }*/ + utils::exec_follow(cmd_args, process_log, running, child); std::this_thread::sleep_for(0.05s); } };