From 66894ed1b05aeead910259b69632f559999d9f33 Mon Sep 17 00:00:00 2001 From: blackxfiied <41133734+blackxfiied@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:40:35 +0800 Subject: [PATCH] Add comments to command functions --- .../Legendary/LegendaryInterface.swift | 17 ++++------------- Mythic/Controllers/Wine/WineInterface.swift | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Mythic/Controllers/Legendary/LegendaryInterface.swift b/Mythic/Controllers/Legendary/LegendaryInterface.swift index 69368f65..8aecea53 100644 --- a/Mythic/Controllers/Legendary/LegendaryInterface.swift +++ b/Mythic/Controllers/Legendary/LegendaryInterface.swift @@ -101,7 +101,7 @@ class Legendary { stderr.fileHandleForReading.readabilityHandler = { [stdin, output] handle in guard let availableOutput = String(data: handle.availableData, encoding: .utf8), !availableOutput.isEmpty else { return } if let trigger = input?(availableOutput), let data = trigger.data(using: .utf8) { - print("wanting to go!!!") + log.debug("input detected, but current implementation is not tested.") stdin.fileHandleForWriting.write(data) } output.stderr = availableOutput @@ -111,7 +111,7 @@ class Legendary { stdout.fileHandleForReading.readabilityHandler = { [stdin, output] handle in guard let availableOutput = String(data: handle.availableData, encoding: .utf8), !availableOutput.isEmpty else { return } if let trigger = input?(availableOutput), let data = trigger.data(using: .utf8) { - print("wanting to go!!!") + log.debug("input detected, but current implementation is not tested.") stdin.fileHandleForWriting.write(data) } output.stdout = availableOutput @@ -125,18 +125,9 @@ class Legendary { log.debug("[command] executing command [\(identifier)]: `\(terminalFormat)`") - try await withCheckedThrowingContinuation { continuation in - DispatchQueue.global(qos: .userInteractive).async { - do { - try task.run() - continuation.resume(returning: ()) - } catch { - continuation.resume(throwing: error) - } - } - } + try task.run() - runningCommands[identifier] = task + runningCommands[identifier] = task // What if two commands with the same identifier execute close to each other? if waits { task.waitUntilExit() } } diff --git a/Mythic/Controllers/Wine/WineInterface.swift b/Mythic/Controllers/Wine/WineInterface.swift index 033f0f8c..1b3ab3c5 100644 --- a/Mythic/Controllers/Wine/WineInterface.swift +++ b/Mythic/Controllers/Wine/WineInterface.swift @@ -211,7 +211,7 @@ class Wine { // TODO: https://forum.winehq.org/viewtopic.php?t=15416 try task.run() - runningCommands[identifier] = task + runningCommands[identifier] = task // What if two commands with the same identifier execute close to each other? if waits { task.waitUntilExit() } }