From 69eb872e1c636da365c7e4ac414862eb1af989e9 Mon Sep 17 00:00:00 2001 From: Valera Cogut Date: Fri, 19 Oct 2018 12:33:19 +0300 Subject: [PATCH] Capture Ctrl+C in cli_wallet when not in daemon mode #1193 - fclose(stdin) solution --- programs/cli_wallet/main.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/programs/cli_wallet/main.cpp b/programs/cli_wallet/main.cpp index 269ddfdf8f..88c027a20e 100644 --- a/programs/cli_wallet/main.cpp +++ b/programs/cli_wallet/main.cpp @@ -280,16 +280,14 @@ int main( int argc, char** argv ) wallet_cli->register_api( wapi ); wallet_cli->start(); - fc::set_signal_handler([&wallet_cli, &wapi, &wallet_file](int signal) { + fc::set_signal_handler([](int signal) { ilog( "Captured SIGINT not in daemon mode" ); - wapi->save_wallet_file(wallet_file.generic_string()); - wallet_cli->quit_blocked_thread(); + fclose(stdin); }, SIGINT); - fc::set_signal_handler([&wallet_cli, &wapi, &wallet_file](int signal) { + fc::set_signal_handler([](int signal) { ilog( "Captured SIGTERM not in daemon mode" ); - wapi->save_wallet_file(wallet_file.generic_string()); - wallet_cli->quit_blocked_thread(); + fclose(stdin); }, SIGTERM); wallet_cli->wait();