Class: Microsandbox::ExecStdin

Inherits:
Object
  • Object
show all
Defined in:
lib/microsandbox/exec_handle.rb

Overview

A writer for a streamed process’s stdin, from Microsandbox::ExecHandle#stdin.

Instance Method Summary collapse

Constructor Details

#initialize(native) ⇒ ExecStdin

Returns a new instance of ExecStdin.



61
62
63
# File 'lib/microsandbox/exec_handle.rb', line 61

def initialize(native)
  @native = native
end

Instance Method Details

#closenil

Send EOF.

Returns:

  • (nil)


77
78
79
80
# File 'lib/microsandbox/exec_handle.rb', line 77

def close
  @native.close
  nil
end

#write(data) ⇒ self

Write data to the process stdin.

Parameters:

  • data (String)

    raw bytes to write (binary-safe)

Returns:

  • (self)

Raises:

  • (TypeError)

    if data is not a String



69
70
71
72
73
# File 'lib/microsandbox/exec_handle.rb', line 69

def write(data)
  bytes = Microsandbox.coerce_write_bytes(data)
  @native.write(bytes)
  self
end