Skip to content

Commit

Permalink
Add comments to command functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vapidinfinity committed Apr 29, 2024
1 parent b889fc5 commit 66894ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
17 changes: 4 additions & 13 deletions Mythic/Controllers/Legendary/LegendaryInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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() }
}
Expand Down
2 changes: 1 addition & 1 deletion Mythic/Controllers/Wine/WineInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
}
Expand Down

0 comments on commit 66894ed

Please sign in to comment.