Sha256: 79b1326a53eeba3142c536b32ea8f38d3d9d1c5492439066655a7184d742c75c

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

#
# if a block is specified then it is passed the child pid and run in a
# background thread.  note that this thread will __not__ be blocked during the
# execution of the command so it may do useful work such as killing the child
# if execution time passes a certain threshold
#
  require 'systemu'

  looper = %q( ruby -e" loop{ STDERR.puts Time.now.to_i; sleep 1 } " )

  status, stdout, stderr =
    systemu looper do |cid|
      sleep 3
      Process.kill 9, cid
    end

  p [ status, stdout, stderr ]

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
systemu-1.0.0 samples/f.rb
systemu-1.1.0 samples/f.rb