Class: Aggkit::ChildProcess::Unix::Lib::Attrs

Inherits:
Object
  • Object
show all
Defined in:
lib/aggkit/childprocess/unix/lib.rb

Overview

FileActions

Instance Method Summary collapse

Constructor Details

#initializeAttrs

Returns a new instance of Attrs.



143
144
145
146
# File 'lib/aggkit/childprocess/unix/lib.rb', line 143

def initialize
  @ptr = FFI::MemoryPointer.new(1, Platform::SIZEOF.fetch(:posix_spawnattr_t), false)
  Lib.check Lib.posix_spawnattr_init(@ptr)
end

Instance Method Details

#flagsObject



157
158
159
160
161
162
# File 'lib/aggkit/childprocess/unix/lib.rb', line 157

def flags
  ptr = FFI::MemoryPointer.new(:short)
  Lib.check Lib.posix_spawnattr_getflags(@ptr, ptr)

  ptr.read_short
end

#flags=(flags) ⇒ Object



153
154
155
# File 'lib/aggkit/childprocess/unix/lib.rb', line 153

def flags=(flags)
  Lib.check Lib.posix_spawnattr_setflags(@ptr, flags)
end

#freeObject



148
149
150
151
# File 'lib/aggkit/childprocess/unix/lib.rb', line 148

def free
  Lib.check Lib.posix_spawnattr_destroy(@ptr)
  @ptr = nil
end

#pgroup=(pid) ⇒ Object



164
165
166
167
# File 'lib/aggkit/childprocess/unix/lib.rb', line 164

def pgroup=(pid)
  self.flags |= Platform::POSIX_SPAWN_SETPGROUP
  Lib.check Lib.posix_spawnattr_setpgroup(@ptr, pid)
end

#to_ptrObject



169
170
171
# File 'lib/aggkit/childprocess/unix/lib.rb', line 169

def to_ptr
  @ptr
end