Hide the waiting for shell message once the shell returns

This commit is contained in:
Maxime Coste 2016-11-30 13:46:20 +00:00
parent 61b3dfd184
commit 99a3388e41

View File

@ -191,6 +191,7 @@ std::pair<String, int> ShellManager::eval(
using namespace std::chrono; using namespace std::chrono;
static constexpr seconds wait_timeout{1}; static constexpr seconds wait_timeout{1};
bool wait_notified = false;
Timer wait_timer{wait_time + wait_timeout, [&](Timer& timer) Timer wait_timer{wait_time + wait_timeout, [&](Timer& timer)
{ {
auto wait_duration = Clock::now() - wait_time; auto wait_duration = Clock::now() - wait_time;
@ -198,6 +199,7 @@ std::pair<String, int> ShellManager::eval(
duration_cast<seconds>(wait_duration).count()), duration_cast<seconds>(wait_duration).count()),
get_face("Information") }, true); get_face("Information") }, true);
timer.set_next_date(Clock::now() + wait_timeout); timer.set_next_date(Clock::now() + wait_timeout);
wait_notified = true;
}, EventMode::Urgent}; }, EventMode::Urgent};
while (not terminated or while (not terminated or
@ -222,6 +224,9 @@ std::pair<String, int> ShellManager::eval(
(size_t)full.count(), (size_t)spawn.count(), (size_t)wait.count())); (size_t)full.count(), (size_t)spawn.count(), (size_t)wait.count()));
} }
if (wait_notified) // clear the status line
context.print_status({ "", get_face("Information") }, true);
return { stdout_contents, WIFEXITED(status) ? WEXITSTATUS(status) : -1 }; return { stdout_contents, WIFEXITED(status) ? WEXITSTATUS(status) : -1 };
} }