Module: Spoon

Extended by:
FFI::Library
Defined in:
lib/spoon/unix.rb,
lib/spoon/windows.rb

Defined Under Namespace

Modules: LibC Classes: FileActions, PointerArray, SpawnAttributes

Constant Summary collapse

P_NOWAIT =
1

Class Method Summary collapse

Class Method Details

.posix_spawn(path, file_actions, spawn_attr, argv, env = ENV) ⇒ Object

Raises:

  • (SystemCallError)


85
86
87
88
89
90
# File 'lib/spoon/unix.rb', line 85

def self.posix_spawn(path, file_actions, spawn_attr, argv, env = ENV)
  pid_ptr, argv_ptr, env_ptr = _prepare_spawn_args(argv, env)
  error = LibC.posix_spawnp(pid_ptr, path, file_actions, spawn_attr, argv_ptr, env_ptr)
  raise SystemCallError.new(path, error) unless error == 0
  get_pid(pid_ptr)
end

.posix_spawnp(file, file_actions, spawn_attr, argv, env = ENV) ⇒ Object

Raises:

  • (SystemCallError)


92
93
94
95
96
97
# File 'lib/spoon/unix.rb', line 92

def self.posix_spawnp(file, file_actions, spawn_attr, argv, env = ENV)
  pid_ptr, argv_ptr, env_ptr = _prepare_spawn_args(argv, env)
  error = LibC.posix_spawnp(pid_ptr, file, file_actions, spawn_attr, argv_ptr, env_ptr)
  raise SystemCallError.new(file, error) unless error == 0
  get_pid(pid_ptr)
end

.spawn(*args) ⇒ Object



99
100
101
# File 'lib/spoon/unix.rb', line 99

def self.spawn(*args)
  posix_spawn(args[0], nil, nil, args, ENV)
end

.spawnp(*args) ⇒ Object



103
104
105
# File 'lib/spoon/unix.rb', line 103

def self.spawnp(*args)
  posix_spawnp(args[0], nil, nil, args, ENV)
end