[cli_wallet] Add ^C signal handler for non-deamon mode
Currently only deamon mode comes with the Ctrl+C
(SIGINT) signal handler. Now in order to properly close the cli_wallet when working in the interactive cli mode, user has to press Ctrl+D
(EOF on standard input) or type exit
(#178 (closed)). User that is not aware of this may accidentally discard all of the changes made to its wallet. Maybe it would be better to also implement SIGINT handler to the interactive mode of the cli_wallet?
Expected Behavior
When Ctrl+C
has been clicked:
save_wallet_file ] Saving wallet to file wallet.json
(exit with status code 0)
Current Behavior
When Ctrl+C
has been clicked:
(Unexpected behavior - program closes without saving the wallet file)
Possible Solution(s)
Add signal handler to the interactive mode of cli_wallet, as it is already implemented in the deamon mode.
Steps to Reproduce
- Run cli_wallet with default options
- Press
Ctrl+C
Context (Environment)
Bug encountered while working on the exit function
Built on Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-154-generic x86_64)
CMake options: -DCMAKE_BUILD_TYPE=Release -DBUILD_HIVE_TESTNET=ON -DENABLE_SMT_SUPPORT=ON -DHIVE_STATIC_BUILD=ON