Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 421 Bytes

README.md

File metadata and controls

35 lines (27 loc) · 421 Bytes

Ruby-Exec-Shell-With-Timeout

Ruby Exec Shell With Timeout

Example Usage (see: example.rb)

#!/usr/bin/env ruby

require 'rubygems'

# include path
$:.unshift File.dirname(__FILE__)

require 'exec_with_timeout.rb'

command = %{ruby -e "(1..100).each {|x| puts x; sleep 1}"}
output = Exec_With_Timeout.exec command, 10
puts output
$ ./example.rb
1
2
3
4
5
6
7
8
9
10