Skip to content

Commit

Permalink
Merge pull request #1232 from cogutvalera/issue_1193
Browse files Browse the repository at this point in the history
Capture Ctrl+C in cli_wallet when not in daemon mode #1193
  • Loading branch information
pmconrad authored Oct 20, 2018
2 parents fc7ed0c + 7dc0de7 commit 0eebc1e
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 0eebc1e

Please sign in to comment.