aboutsummaryrefslogtreecommitdiff
path: root/ttwhy/terminal/signal_handling.cppm
diff options
context:
space:
mode:
Diffstat (limited to 'ttwhy/terminal/signal_handling.cppm')
-rw-r--r--ttwhy/terminal/signal_handling.cppm11
1 files changed, 11 insertions, 0 deletions
diff --git a/ttwhy/terminal/signal_handling.cppm b/ttwhy/terminal/signal_handling.cppm
index a3b5d4d..95b92f1 100644
--- a/ttwhy/terminal/signal_handling.cppm
+++ b/ttwhy/terminal/signal_handling.cppm
@@ -11,6 +11,17 @@ export module ttwhy.terminal:signal_handling;
namespace ttwhy::terminal
{
+ //! Asynchronously handle POSIX process and job-control signals for a terminal application.
+ //!
+ //! Intercepts SIGINT and SIGTERM to print an exit notification and terminate gracefully.
+ //! Intercepts SIGTSTP to restore terminal canonical and echo flags before raising SIGSTOP,
+ //! and intercepts SIGCONT to restore the terminal attributes when execution resumes.
+ //!
+ //! @tparam Stream The output stream type used for writing diagnostic messages.
+ //! @tparam TerminalAttributes The terminal attributes manager type.
+ //! @param stream The stream to write diagnostic messages to.
+ //! @param attributes The scoped attributes managing terminal canonical mode and echo.
+ //! @return An awaitable task that yields an error code upon termination.
export template<typename Stream, typename TerminalAttributes>
auto handle_signals(Stream & stream, TerminalAttributes & attributes) -> asio::awaitable<std::error_code>
{