aboutsummaryrefslogtreecommitdiff
path: root/ttwhy/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ttwhy/main.cpp')
-rw-r--r--ttwhy/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/ttwhy/main.cpp b/ttwhy/main.cpp
index 6a813c0..53cf16d 100644
--- a/ttwhy/main.cpp
+++ b/ttwhy/main.cpp
@@ -10,6 +10,10 @@ auto app(int in, int out, int error) -> asio::awaitable<void>
{
using namespace asio::experimental::awaitable_operators;
+ auto terminal_attributes = ttwhy::scoped_attributes{fileno(stdin)} //
+ .canonical_mode(false)
+ .echo(false);
+
auto executor = co_await asio::this_coro::executor;
auto input_stream = asio::posix::stream_descriptor{executor, in};
@@ -18,14 +22,12 @@ auto app(int in, int out, int error) -> asio::awaitable<void>
auto router = ttwhy::routers::echo{input_stream};
- co_await (ttwhy::io::handle_signals(error_stream) || ttwhy::io::read_events(input_stream, router));
+ co_await (ttwhy::io::handle_signals(error_stream, terminal_attributes) ||
+ ttwhy::io::read_events(input_stream, router));
}
auto main() -> int
{
- auto terminal_attributes = ttwhy::scoped_attributes{fileno(stdin)} //
- .canonical_mode(false)
- .echo(false);
auto context = asio::io_context{};
asio::co_spawn(context, app(::fileno(::stdin), ::fileno(::stdout), ::fileno(::stderr)), asio::detached);