Skip to content

Commit cfaa58f

Browse files
authored
Merge pull request #349 from tompng/avoid_stdin_read_from_watch_command
Avoid stdin read by tailwindcss watch command
2 parents 828eacc + edd90d5 commit cfaa58f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: lib/puma/plugin/tailwindcss.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ def start(launcher)
88
@puma_pid = $$
99
@tailwind_pid = fork do
1010
Thread.new { monitor_puma }
11-
system(*Tailwindcss::Commands.watch_command)
11+
# Using IO.popen(command, 'r+') will avoid watch_command read from $stdin.
12+
# If we use system(*command) instead, IRB and Debug can't read from $stdin
13+
# correctly bacause some keystrokes will be taken by watch_command.
14+
IO.popen(Tailwindcss::Commands.watch_command, 'r+') do |io|
15+
IO.copy_stream(io, $stdout)
16+
end
1217
end
1318

1419
launcher.events.on_stopped { stop_tailwind }

0 commit comments

Comments
 (0)