Skip to content

Commit

Permalink
fix: shutdown fusuma process when EOFError occurs
Browse files Browse the repository at this point in the history
- handle EOFError in each input plugin to shutdown fusuma process
  • Loading branch information
iberianpig committed Jul 2, 2024
1 parent cdb0779 commit 3b25af6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/fusuma/plugin/inputs/remap_keyboard_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def read_from_io

status = (data["status"] == 1) ? "pressed" : "released"
Events::Records::KeypressRecord.new(status: status, code: data["key"], layer: data["layer"])
rescue EOFError => e
MultiLogger.error "#{self.class.name}: #{e}"
MultiLogger.error "Shutdown fusuma process..."
Process.kill("TERM", Process.pid)
end

private
Expand Down
4 changes: 4 additions & 0 deletions lib/fusuma/plugin/inputs/remap_touchpad_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def read_from_io
end

Events::Records::GestureRecord.new(gesture: gesture, status: status, finger: finger, delta: nil)
rescue EOFError => e
MultiLogger.error "#{self.class.name}: #{e}"
MultiLogger.error "Shutdown fusuma process..."
Process.kill("TERM", Process.pid)
end

private
Expand Down

0 comments on commit 3b25af6

Please sign in to comment.