Class: Spoon::SpawnAttributes
- Inherits:
-
Object
- Object
- Spoon::SpawnAttributes
- Defined in:
- lib/spoon/unix.rb
Constant Summary collapse
- SIZE =
FFI::Platform.mac? ? FFI.type_size(:pointer) : 128
Instance Attribute Summary collapse
-
#pointer ⇒ Object
readonly
Returns the value of attribute pointer.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ SpawnAttributes
constructor
A new instance of SpawnAttributes.
- #pgroup ⇒ Object
- #pgroup=(group) ⇒ Object
Constructor Details
#initialize ⇒ SpawnAttributes
Returns a new instance of SpawnAttributes.
56 57 58 59 60 |
# File 'lib/spoon/unix.rb', line 56 def initialize @pointer = FFI::AutoPointer.new(LibC.malloc(SIZE), self.class) error = LibC.posix_spawnattr_init(@pointer) raise SystemCallError.new("posix_spawnattr_init", error) unless error == 0 end |
Instance Attribute Details
#pointer ⇒ Object (readonly)
Returns the value of attribute pointer.
53 54 55 |
# File 'lib/spoon/unix.rb', line 53 def pointer @pointer end |
Class Method Details
Instance Method Details
#pgroup ⇒ Object
73 74 75 76 77 78 |
# File 'lib/spoon/unix.rb', line 73 def pgroup group = FFI::MemoryPointer.new :pid_t error = LibC.posix_spawnattr_getpgroup(pointer, group) raise SystemCallError.new("posix_spawnattr_getpgroup", error) unless error == 0 get_pid(group) end |
#pgroup=(group) ⇒ Object
67 68 69 70 71 |
# File 'lib/spoon/unix.rb', line 67 def pgroup=(group) error = LibC.posix_spawnattr_setpgroup(pointer, group) raise SystemCallError.new("posix_spawnattr_setpgroup", error) unless error == 0 group end |