Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ public extension Process {

extension FileHandle {
func nextLine() -> String? {
while availableData.isEmpty {
Thread.sleep(forTimeInterval: 0.2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is really a solution. This is still going to block the entire thread responsible for handling logs and can arguably lead to more downtime then spin-waiting

Copy link
Author

@ethanaobrien ethanaobrien Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an alternative approach that can be taken? At the moment this issue causes a 100% utilized thread per opened application, so when I open 3 apps from the whisky menu I have a 300% CPU usage by whisky and get a ridiculous power draw for nothing.

}
if let line = String(data: availableData, encoding: .utf8) {
guard !line.isEmpty else { return nil }
return line
Expand Down