Skip to content

Commit

Permalink
fix deadlock issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fuji246 committed Apr 9, 2019
1 parent 486b96c commit aee62a0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions LomoAgent/StatusMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class StatusMenuController: NSObject {
var preferencesWindow: PreferencesWindow!
var aboutWindow: AboutWindow!
var lomodTask: Process?
var pipe: Pipe!
var stateTimer: Timer!

let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
Expand Down Expand Up @@ -126,9 +125,6 @@ class StatusMenuController: NSObject {
if UserDefaults.standard.bool(forKey: PREF_DEBUG_MODE) {
task.arguments?.append("--debug")
}
pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe
task.launch()

os_log("lomod is running: %d, pid = %d", log: .logic, task.isRunning, task.processIdentifier)
Expand All @@ -146,10 +142,7 @@ class StatusMenuController: NSObject {
os_log("lomod terminate, pid = %d", log: .ui, task.processIdentifier)
task.terminate()
} else if lomodTask != nil {
let handle = pipe.fileHandleForReading
let data = handle.readDataToEndOfFile()
let output = String (data: data, encoding: String.Encoding.utf8)
os_log("lomod already terminate with error: %{public}s", log: .logic, type: .error, output!)
os_log("lomod already terminate with error: %{public}s", log: .logic, type: .error)
}
lomodTask = nil
}
Expand Down
Binary file modified dependencies/lomod/Contents/MacOS/lomod
Binary file not shown.

0 comments on commit aee62a0

Please sign in to comment.