Skip to content

Commit

Permalink
Merge pull request #349 from tompng/avoid_stdin_read_from_watch_command
Browse files Browse the repository at this point in the history
Avoid stdin read by tailwindcss watch command
  • Loading branch information
flavorjones committed Apr 25, 2024
2 parents 828eacc + edd90d5 commit cfaa58f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/puma/plugin/tailwindcss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ def start(launcher)
@puma_pid = $$
@tailwind_pid = fork do
Thread.new { monitor_puma }
system(*Tailwindcss::Commands.watch_command)
# Using IO.popen(command, 'r+') will avoid watch_command read from $stdin.
# If we use system(*command) instead, IRB and Debug can't read from $stdin
# correctly bacause some keystrokes will be taken by watch_command.
IO.popen(Tailwindcss::Commands.watch_command, 'r+') do |io|
IO.copy_stream(io, $stdout)
end
end

launcher.events.on_stopped { stop_tailwind }
Expand Down

0 comments on commit cfaa58f

Please sign in to comment.