Class: HotCell::Fixtures::StderrWriter

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

Overview

Writes to fd 2 and then either dies the way a C library does — exit() with no Ruby exception, so there is no worker.crashed line and nothing on the connection — or returns normally, which is the warning a cell deliberately does not report. noise: goes out before text:, so a test can ask which end of an oversized transcript was kept.

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, text:, noise: 0, fatal: false) ⇒ Object



509
510
511
512
513
514
515
516
# File 'lib/hot_cell/test_operations.rb', line 509

def perform(_inputs, _outputs, text:, noise: 0, fatal: false)
  $stderr.write "noise\n" * noise
  $stderr.write text
  $stderr.flush
  exit! 1 if fatal

  { wrote: text.bytesize }
end