Class: HotCell::Fixtures::ReadThroughFd

Inherits:
Operation
  • Object
show all
Defined in:
lib/hot_cell/test_operations.rb

Overview

Hands an exec'd tool the input descriptor and has it read the bytes back through /dev/fd, so a test can prove run_tool's pass: exposes a descriptor to a tool without staging it. Reports whether the input was copied onto scratch, which must be false.

Constant Summary

Constants inherited from Operation

Operation::READ_BYTES

Instance Method Summary collapse

Methods inherited from Operation

abstract_operation, abstract_operation?, before_fork, before_worker_boot, inherited, limits, operation, operation_name, #run_tool, unreadable

Instance Method Details

#perform(inputs, _outputs) ⇒ Object



271
272
273
274
275
276
# File 'lib/hot_cell/test_operations.rb', line 271

def perform(inputs, _outputs)
  source, = inputs
  result = run_tool "cat", source.fd_path, pass: [ source.to_io ]

  { content: result.out, ok: result.ok?, staged: source.staged? }
end