From 9c565598f95bba22032b34a8baad2de3d31d55d7 Mon Sep 17 00:00:00 2001 From: Thiflict <121az348@gmail.com> Date: Mon, 20 Apr 2026 20:35:07 +0500 Subject: [PATCH] =?UTF-8?q?#4=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B8=D0=BD=D0=B4=D0=B8=D0=BA=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=20=D1=84=D0=B0=D0=BD=D1=82=D0=BE=D0=BC?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D1=80=D0=B0=D0=B7=D0=BC=D0=BE=D0=BD=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8=20=D1=83=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=B9=D1=81=D1=82=D0=B2=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/Main.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index de75146..5f007f7 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -274,7 +274,11 @@ class USBVirusScanner { currentState = SystemState.IDLE - } catch (e: Exception) { + } catch (e: kotlinx.coroutines.CancellationException) { + currentState = SystemState.IDLE + println(if (isDebug) "Программа получила CancellationException. Возврат к состоянию IDLE." else "") + } + catch (e: Exception) { println(if (isDebug) "❌ Критическая ошибка: ${e.message}" else "") e.printStackTrace() currentState = SystemState.ERROR @@ -513,7 +517,7 @@ class USBVirusScanner { } } - + fun shutdown() { println(if (isDebug) "\nЗавершение работы..." else "") isRunning = false @@ -649,7 +653,8 @@ fun main(args: Array) { } } catch (e: Exception) { println(if (isDebug) "❌ Критическая ошибка: ${e.message}" else "") - e.printStackTrace() + if (isDebug) e.printStackTrace() + if (isDebug) println("Общий Exception") scanner.shutdown() exitProcess(1) }