Skip to content

Commit

Permalink
Capture Ctrl+C in cli_wallet when not in daemon mode #1193
Browse files Browse the repository at this point in the history
  • Loading branch information
cogutvalera committed Oct 19, 2018
1 parent fc7ed0c commit 7dc0de7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions programs/cli_wallet/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ int main( int argc, char** argv )
{
wallet_cli->register_api( wapi );
wallet_cli->start();

fc::set_signal_handler([](int signal) {
ilog( "Captured SIGINT not in daemon mode" );
fclose(stdin);
}, SIGINT);

fc::set_signal_handler([](int signal) {
ilog( "Captured SIGTERM not in daemon mode" );
fclose(stdin);
}, SIGTERM);

wallet_cli->wait();
}
else
Expand All @@ -288,6 +299,10 @@ int main( int argc, char** argv )
exit_promise->set_value(signal);
}, SIGINT);

fc::set_signal_handler([&exit_promise](int signal) {
exit_promise->set_value(signal);
}, SIGTERM);

ilog( "Entering Daemon Mode, ^C to exit" );
exit_promise->wait();
}
Expand Down

0 comments on commit 7dc0de7

Please sign in to comment.