Class: Ask::Sandbox::Result

Inherits:
Data
  • Object
show all
Defined in:
lib/ask/sandbox/base.rb

Overview

Structured result from a sandbox command execution.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exit_codeInteger? (readonly)

Returns process exit code (nil if killed by signal).

Returns:

  • (Integer, nil)

    process exit code (nil if killed by signal)



31
32
33
34
35
36
# File 'lib/ask/sandbox/base.rb', line 31

Result = Data.define(:stdout, :stderr, :exit_code, :timed_out) do
  # @return [Boolean] true if the command exited successfully (exit code 0)
  def success?
    exit_code == 0
  end
end

#stderrString (readonly)

Returns captured standard error.

Returns:

  • (String)

    captured standard error



31
32
33
34
35
36
# File 'lib/ask/sandbox/base.rb', line 31

Result = Data.define(:stdout, :stderr, :exit_code, :timed_out) do
  # @return [Boolean] true if the command exited successfully (exit code 0)
  def success?
    exit_code == 0
  end
end

#stdoutString (readonly)

Returns captured standard output.

Returns:

  • (String)

    captured standard output



31
32
33
34
35
36
# File 'lib/ask/sandbox/base.rb', line 31

Result = Data.define(:stdout, :stderr, :exit_code, :timed_out) do
  # @return [Boolean] true if the command exited successfully (exit code 0)
  def success?
    exit_code == 0
  end
end

#timed_outBoolean (readonly)

Returns whether execution was terminated due to timeout.

Returns:

  • (Boolean)

    whether execution was terminated due to timeout



31
32
33
34
35
36
# File 'lib/ask/sandbox/base.rb', line 31

Result = Data.define(:stdout, :stderr, :exit_code, :timed_out) do
  # @return [Boolean] true if the command exited successfully (exit code 0)
  def success?
    exit_code == 0
  end
end

Instance Method Details

#success?Boolean

Returns true if the command exited successfully (exit code 0).

Returns:

  • (Boolean)

    true if the command exited successfully (exit code 0)



33
34
35
# File 'lib/ask/sandbox/base.rb', line 33

def success?
  exit_code == 0
end