mmgen-xmrwallet: force-kill wallet daemon on double Ctrl-C
This commit is contained in:
parent
c586e5e38f
commit
6620db4158
4 changed files with 11 additions and 6 deletions
|
|
@ -194,6 +194,8 @@ class Daemon(Lockable):
|
|||
if self.state == 'ready':
|
||||
if not silent:
|
||||
msg(f'Stopping {self.desc} on port {self.bind_port}')
|
||||
if self.force_kill:
|
||||
run(['sync'])
|
||||
ret = self.run_cmd(self.stop_cmd,silent=True)
|
||||
|
||||
if self.pids:
|
||||
|
|
|
|||
|
|
@ -163,8 +163,5 @@ if cfg.autosign and not cfg.test_suite:
|
|||
|
||||
m = op_cls(cfg, xmrwallet_uargs(infile, wallets, spec))
|
||||
|
||||
try:
|
||||
if async_run(m.main()):
|
||||
m.post_main()
|
||||
except KeyboardInterrupt:
|
||||
ymsg('\nUser interrupt')
|
||||
if async_run(m.main()):
|
||||
m.post_main()
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ class MoneroWalletDaemon(RPCDaemon):
|
|||
new_console_mswin = True
|
||||
networks = ('mainnet','testnet')
|
||||
rpc_ports = _nw(13131, 13141, None) # testnet is non-standard
|
||||
_reset_ok = ('debug','wait','pids','force_kill')
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -867,7 +867,12 @@ class MoneroWalletOps:
|
|||
|
||||
async def stop_wallet_daemon(self):
|
||||
if not self.cfg.no_stop_wallet_daemon:
|
||||
await self.c.stop_daemon()
|
||||
try:
|
||||
await self.c.stop_daemon()
|
||||
except KeyboardInterrupt:
|
||||
ymsg('\nForce killing wallet daemon')
|
||||
self.c.daemon.force_kill = True
|
||||
self.c.daemon.stop()
|
||||
|
||||
def get_wallet_fn(self,data,watch_only=None):
|
||||
if watch_only is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue