Commit b316df46 authored by Cédric Boutillier's avatar Cédric Boutillier

Imported Upstream version 0.0.4

parent eae43000
......@@ -20,15 +20,17 @@ module Spoon
SIZE = FFI::Platform.mac? ? FFI.type_size(:pointer) : 128
def initialize
@pointer = FFI::AutoPointer.new(LibC.malloc(SIZE), self.class)
@pointer = FFI::AutoPointer.new(LibC.malloc(SIZE), Releaser)
error = LibC.posix_spawn_file_actions_init(@pointer)
raise SystemCallError.new("posix_file_actions_init", error) unless error == 0
end
def self.release(ptr)
class Releaser
def self.call(ptr)
LibC.posix_spawn_file_actions_destroy(ptr)
LibC.free(ptr)
end
end
def open(fd, path, oflag, mode)
error = LibC.posix_spawn_file_actions_addopen(@pointer, fd, path, oflag, mode)
......@@ -51,18 +53,20 @@ module Spoon
class SpawnAttributes
attr_reader :pointer
SIZE = FFI::Platform.mac? ? FFI.type_size(:pointer) : 128
SIZE = FFI::Platform.mac? ? FFI.type_size(:pointer) : 512
def initialize
@pointer = FFI::AutoPointer.new(LibC.malloc(SIZE), self.class)
@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
def self.release(ptr)
class Releaser
def self.call(ptr)
LibC.posix_spawnattr_destroy(ptr)
LibC.free(ptr)
end
end
def pgroup=(group)
error = LibC.posix_spawnattr_setpgroup(pointer, group)
......
--- !ruby/object:Gem::Specification
name: spoon
version: !ruby/object:Gem::Version
version: 0.0.3
prerelease:
version: 0.0.4
platform: ruby
authors:
- Charles Oliver Nutter
......
Gem::Specification.new do |s|
s.name = "spoon"
s.version = "0.0.3"
s.version = "0.0.4"
s.authors = ["Charles Oliver Nutter"]
s.date = "2013-03-29"
s.description = s.summary = "Spoon is an FFI binding of the posix_spawn function (and Windows equivalent), providing fork+exec functionality in a single shot."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment