Skip to content

Commit

Permalink
Capture Ctrl+C in cli_wallet when not in daemon mode #1193 - fclose(s…
Browse files Browse the repository at this point in the history
…tdin) solution
  • Loading branch information
cogutvalera committed Oct 19, 2018
1 parent ad21932 commit e4b59b7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions programs/cli_wallet/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e4b59b7

Please sign in to comment.