class MXC::Result
The outcome of a command that ran in a sandbox.
result = MXC.run("python3 build.py") result.success? # => true result.stdout # => "built 3 files\n"
Attributes
Returns the backend that ran the command, such as :bubblewrap.
Returns the host:port destinations the network allow-list refused.
Returns the CPU time the command used, user and system, in seconds as a Float. It includes every process the command started and waited for. Returns nil unless the sandbox has limits or a priority.
Returns the exit code, or nil when the command timed out.
Returns the limit the command ran into: :cpu_time, :memory, :processes, or nil. Linux and macOS report :cpu_time only, because a program that cannot allocate memory decides itself how to fail.
Returns everything the command wrote to standard error.
Returns everything the command wrote to standard output.
Returns MXC’s warnings about the sandbox, as Strings.
Public Instance Methods
Source
# File lib/mxc/result.rb, line 52 def success? !timed_out? && exit_code.zero? end
Returns true when the command exited with status 0 before its timeout.
Source
# File lib/mxc/result.rb, line 57 def timed_out? @timed_out end
Returns true when the command ran out of time and was stopped.
Source
# File lib/mxc/result.rb, line 62 def to_h { stdout:, stderr:, exit_code:, timed_out: timed_out?, warnings:, blocked:, backend:, cpu_time:, limit_exceeded: } end
Returns the result as a Hash.