examples/jail.rb
changeset 7 4460fc10c6a3
equal deleted inserted replaced
6:2d52adc4adcc 7:4460fc10c6a3
       
     1 #!/usr/bin/env ruby
       
     2 #
       
     3 # An example 'jail' utility in ruby.
       
     4 #
       
     5 
       
     6 BEGIN {
       
     7         require 'pathname'
       
     8         basedir = Pathname.new( __FILE__ ).dirname.parent
       
     9 
       
    10         $LOAD_PATH.unshift basedir + "ext" unless 
       
    11                 $LOAD_PATH.include? basedir + "ext"
       
    12 }
       
    13 
       
    14 require 'jail'
       
    15 
       
    16 jid = BSD::Jail.create( '127.0.0.1', '/tmp', 'testjail' )
       
    17 puts "New jail created with id: %d" % [ jid ]
       
    18 
       
    19 # We're in the jail, now.
       
    20 Dir.foreach('.') { |i| puts i }
       
    21