fix: Cleanup temporary file after feeding auth data

Related: #366
This commit is contained in:
Kevin Yue committed 2024-06-11 22:20:49 +08:00
1 parent a25b5cb894
commit 54d4f2ec57
3 files changed
+22 -11

No files matched your search

+6 -1
View File
@@ -1,4 +1,4 @@
use std::{collections::HashMap, fs, path::PathBuf};
use std::{collections::HashMap, env::temp_dir, fs, path::PathBuf};
use clap::Args;
use directories::ProjectDirs;
@@ -82,6 +82,11 @@ impl<'a> LaunchGuiHandler<'a> {
async fn feed_auth_data(auth_data: &str) -> anyhow::Result<()> {
let _ = tokio::join!(feed_auth_data_gui(auth_data), feed_auth_data_cli(auth_data));
// Cleanup the temporary file
let html_file = temp_dir().join("gpauth.html");
let _ = std::fs::remove_file(html_file);
Ok(())
}