Class: Spoon::SpawnAttributes
- Inherits:
-
Object
- Object
- Spoon::SpawnAttributes
- Defined in:
- lib/spoon/unix.rb
Defined Under Namespace
Classes: Releaser
Constant Summary collapse
- SIZE =
FFI::Platform.mac? ? FFI.type_size(:pointer) : 512
Instance Attribute Summary collapse
-
#pointer ⇒ Object
readonly
Returns the value of attribute pointer.
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.
58 59 60 61 62 |
# File 'lib/spoon/unix.rb', line 58 def initialize @pointer = FFI::AutoPointer.new(LibC.malloc(SIZE), Releaser) 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.
55 56 57 |
# File 'lib/spoon/unix.rb', line 55 def pointer @pointer end |
Instance Method Details
#pgroup ⇒ Object
77 78 79 80 81 82 |
# File 'lib/spoon/unix.rb', line 77 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
71 72 73 74 75 |
# File 'lib/spoon/unix.rb', line 71 def pgroup=(group) error = LibC.posix_spawnattr_setpgroup(pointer, group) raise SystemCallError.new("posix_spawnattr_setpgroup", error) unless error == 0 group end |