piotrmurach/tty-command

View on GitHub
examples/threaded.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require_relative "../lib/tty-command"

cmd = TTY::Command.new

threads = []
3.times do |i|
  th = Thread.new do
    10.times { cmd.run("echo th#{i}; sleep 0.1") }
  end
  threads << th
end
threads.each(&:join)