Skip to content

Ensure reload works even when the socket directory does not exist #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions lib/rails_live_reload/watcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "fileutils"

module RailsLiveReload
class Watcher
attr_reader :files, :sockets
Expand All @@ -21,6 +23,7 @@ def initialize
end

build_tree
create_socket_directory
start_socket
start_listener
end
Expand Down Expand Up @@ -55,6 +58,10 @@ def reload_all
end
end

def create_socket_directory
FileUtils.mkdir_p File.dirname(RailsLiveReload.config.socket_path)
end

def start_socket
Thread.new do
Socket.unix_server_socket(RailsLiveReload.config.socket_path.to_s) do |sock|
Expand Down