Skip to content

Commit

Permalink
The tailwindcss watch process must not steal keystrokes
Browse files Browse the repository at this point in the history
which would break the debugger.
  • Loading branch information
flavorjones committed Apr 27, 2024
1 parent f77a0ce commit 534a840
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/tailwindcss/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ class Engine < ::Rails::Engine

server do
tailwind_pid = fork do
exec(*Tailwindcss::Commands.watch_command(always: true))
# To avoid stealing keystrokes from the debug gem's IRB console in the main process (which
# needs to be able to read from $stdin), we use `IO.open(..., 'r+')`.
IO.popen(Tailwindcss::Commands.watch_command, 'r+') do |io|
IO.copy_stream(io, $stdout)
end
end
at_exit do
Process.kill(:INT, tailwind_pid)
Expand Down

0 comments on commit 534a840

Please sign in to comment.