mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-06-19 12:24:14 -04:00
feat: Kill monero-wallet-rpc on GUI exit
This commit is contained in:
parent
acdb0231b5
commit
718132b8b4
3 changed files with 37 additions and 10 deletions
|
@ -11,7 +11,7 @@ use swap::{
|
|||
},
|
||||
cli::command::{Bitcoin, Monero},
|
||||
};
|
||||
use tauri::{Manager, State};
|
||||
use tauri::{Manager, RunEvent, State};
|
||||
|
||||
trait ToStringResult<T> {
|
||||
fn to_string_result(self) -> Result<T, String>;
|
||||
|
@ -107,6 +107,16 @@ pub fn run() {
|
|||
withdraw_btc
|
||||
])
|
||||
.setup(setup)
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while building tauri application")
|
||||
.run(|app, event| match event {
|
||||
RunEvent::Exit | RunEvent::ExitRequested { .. } => {
|
||||
let context = app.state::<Arc<Context>>().inner();
|
||||
|
||||
if let Err(err) = context.cleanup() {
|
||||
println!("Cleanup failed {}", err);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue