parent
cf7c638025
commit
95a4d70379
|
@ -355,6 +355,7 @@ std::pair<String, int> ShellManager::eval(
|
|||
client.redraw_ifn();
|
||||
}, EventMode::Urgent};
|
||||
|
||||
bool cancelling = false;
|
||||
while (not terminated or child_stdin.write_fd() != -1 or
|
||||
((flags & Flags::WaitForStdout) and
|
||||
(child_stdout.read_fd() != -1 or child_stderr.read_fd() != -1)))
|
||||
|
@ -363,6 +364,11 @@ std::pair<String, int> ShellManager::eval(
|
|||
{
|
||||
EventManager::instance().handle_next_events(EventMode::Urgent, &orig_mask);
|
||||
}
|
||||
catch (cancel&)
|
||||
{
|
||||
kill(pid, SIGINT);
|
||||
cancelling = true;
|
||||
}
|
||||
catch (runtime_error& error)
|
||||
{
|
||||
write_to_debug_buffer(format("error while waiting for shell: {}", error.what()));
|
||||
|
@ -385,6 +391,9 @@ std::pair<String, int> ShellManager::eval(
|
|||
(size_t)full.count(), (size_t)spawn.count(), (size_t)wait.count()));
|
||||
}
|
||||
|
||||
if (cancelling)
|
||||
throw cancel{};
|
||||
|
||||
if (previous_status) // restore the status line
|
||||
{
|
||||
context.print_status(std::move(*previous_status));
|
||||
|
|
Loading…
Reference in New Issue
Block a user