module ExecSandbox
TODO(pwnall): documentation
namespace
namespace
namespace
namespace
Public Class Methods
open(admin = Etc.getlogin)
click to toggle source
Creates a sandbox.
The sandbox should be disposed of by calling {Sandbox#close} on it. This method is much less convenient than use, so make sure you have a good reason to call it.
@param [String] admin the name of a user who will be able to peek into the
sandbox (optional)
@return [Sandbox] the newly created sandbox
# File lib/exec_sandbox/sandbox.rb, line 196 def self.open(admin = Etc.getlogin) ExecSandbox::Sandbox.new admin end
use(admin = Etc.getlogin) { |sandbox| ... }
click to toggle source
Creates a sandbox, yields it, and destroys it.
@param [String] admin the name of a user who will be able to peek into the
sandbox (optional)
@yieldparam [Sandbox] sandbox a Sandbox
instance that will be automatically
destroyed after the block returns
@return the value returned from the block passed to this method
# File lib/exec_sandbox/sandbox.rb, line 178 def self.use(admin = Etc.getlogin, &block) sandbox = ExecSandbox::Sandbox.new admin begin return yield(sandbox) ensure sandbox.close end end