mirror of
https://github.com/Universal-Debloater-Alliance/universal-android-debloater-next-generation.git
synced 2026-08-11 16:19:11 +02:00
fix(app): exclude windows terminal attach
This commit is contained in:
parent
45b22318c1
commit
6ed6c1f36e
1 changed files with 11 additions and 8 deletions
19
src/main.rs
19
src/main.rs
|
|
@ -26,8 +26,13 @@ fn main() -> iced::Result {
|
|||
gui::UadGui::start()
|
||||
}
|
||||
|
||||
/// Sets up logging to a new file in CACHE_DIR/UAD_{time}.log
|
||||
/// Also attaches the terminalon windows machines
|
||||
pub fn setup_logger() -> Result<(), fern::InitError> {
|
||||
attach_windows_console();
|
||||
/// Attach windows terminal, only on windows
|
||||
#[cfg(target_os = "windows")] {
|
||||
attach_windows_console();
|
||||
}
|
||||
|
||||
let colors = ColoredLevelConfig::new().info(Color::Green);
|
||||
|
||||
|
|
@ -80,13 +85,11 @@ pub fn setup_logger() -> Result<(), fern::InitError> {
|
|||
/// (Windows) Allow the application to display logs to the terminal
|
||||
/// regardless if it was compiled with `windows_subsystem = "windows"`.
|
||||
///
|
||||
/// This is a no-op when compiled to non-windows targets.
|
||||
/// This is excluded on non-windows targets.
|
||||
#[cfg(target_os = "windows")]
|
||||
fn attach_windows_console() {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
use win32console::console::WinConsole;
|
||||
use win32console::console::WinConsole;
|
||||
|
||||
const ATTACH_PARENT_PROCESS: u32 = 0xFFFFFFFF;
|
||||
let _ = WinConsole::attach_console(ATTACH_PARENT_PROCESS);
|
||||
}
|
||||
const ATTACH_PARENT_PROCESS: u32 = 0xFFFFFFFF;
|
||||
let _ = WinConsole::attach_console(ATTACH_PARENT_PROCESS);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue