Class: KairosMcp::Daemon::RestrictedShell::SandboxContext
- Inherits:
-
Object
- Object
- KairosMcp::Daemon::RestrictedShell::SandboxContext
- Defined in:
- lib/kairos_mcp/daemon/restricted_shell/sandbox_context.rb
Overview
SandboxContext — holds sandbox-wrapped command + cleanup handle.
Instance Attribute Summary collapse
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
Instance Method Summary collapse
- #cleanup! ⇒ Object
-
#initialize(cmd:, driver: :none, tmpdir: nil) ⇒ SandboxContext
constructor
A new instance of SandboxContext.
Constructor Details
#initialize(cmd:, driver: :none, tmpdir: nil) ⇒ SandboxContext
Returns a new instance of SandboxContext.
12 13 14 15 16 |
# File 'lib/kairos_mcp/daemon/restricted_shell/sandbox_context.rb', line 12 def initialize(cmd:, driver: :none, tmpdir: nil) @cmd = cmd @driver = driver @tmpdir = tmpdir end |
Instance Attribute Details
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
10 11 12 |
# File 'lib/kairos_mcp/daemon/restricted_shell/sandbox_context.rb', line 10 def cmd @cmd end |
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
10 11 12 |
# File 'lib/kairos_mcp/daemon/restricted_shell/sandbox_context.rb', line 10 def driver @driver end |
Instance Method Details
#cleanup! ⇒ Object
18 19 20 21 22 |
# File 'lib/kairos_mcp/daemon/restricted_shell/sandbox_context.rb', line 18 def cleanup! FileUtils.rm_rf(@tmpdir) if @tmpdir && Dir.exist?(@tmpdir) rescue StandardError # best-effort end |