Sha256: 4cb17f80e231af6a0550426a6c4f424d7251d61387dc59bb3d0ff9284a0ae8e5
Contents?: true
Size: 759 Bytes
Versions: 34
Compression:
Stored size: 759 Bytes
Contents
<% begin %> <% Open3.popen3("bash -x -e") do |stdin, stdout, stderr, wait_thr| %> <% output = [] %> <% Thread.new do until (line = stdout.gets).nil? do output << [ :stdout, line ] end end %> <% Thread.new do until (line = stderr.gets).nil? do output << [ :stderr, line ] end end %> <% stdin.puts script %> <% stdin.puts "exit" %> <% wait_thr.join %> <% output.each do |key, line| %> <% if key == :stdout %> <p><%= h line %></p> <% elsif line =~ /^\+ (.*)/ %> <p class="text-info">$ <%= h $1 %></p> <% else %> <p class="text-danger"><%= h line %></p> <% end %> <% end %> <% end %> <% rescue => error %> <%= erb :error, locals: { error: error }, layout: false %> <% end %>
Version data entries
34 entries across 34 versions & 1 rubygems