Sha256: 50d7212a73f706edad1e35f06808222b1eb6a18b11db3f5a31ca023219b921f0

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

= Subexec
by Peter Kieltyka
http://github/nulayer/subexec

=== Description

Subexec is a simple library that spawns an external command with
an optional timeout parameter. It relies on Ruby 1.9's Process.spawn
method. Also, it works with synchronous and asynchronous code.

Useful for libraries that are Ruby wrappers for CLI's. For example,
resizing images with ImageMagick's mogrify command sometimes stalls
and never returns control back to the original process. Enter Subexec.

=== Usage

  sub = Subexec.run "echo 'hello' && sleep 3", :timeout => 5
  puts sub.output     # returns: hello
  puts sub.exitstatus # returns: 0

  sub = Subexec.run "echo 'hello' && sleep 3", :timeout => 1
  puts sub.output     # returns: 
  puts sub.exitstatus # returns:


=== Limitations

Supports only Ruby 1.9.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
subexec-0.0.3 README.rdoc
subexec-0.0.2 README.rdoc
subexec-0.0.1 README.rdoc