Skip to content

Commit

Permalink
If posix_spawn or posix_spawnp returns an error, turn that error code…
Browse files Browse the repository at this point in the history
… into an exception.
  • Loading branch information
evilrich committed May 24, 2012
1 parent dce1961 commit 9baec25
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/spoon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ module Spoon

def self.spawn(*args)
spawn_args = _prepare_spawn_args(args)
_posix_spawn(*spawn_args)
errno = _posix_spawn(*spawn_args)
raise SystemCallError.new(args[0], errno) if errno != 0
spawn_args[0].read_int
end

def self.spawnp(*args)
spawn_args = _prepare_spawn_args(args)
_posix_spawnp(*spawn_args)
errno = _posix_spawnp(*spawn_args)
raise SystemCallError.new(args[0], errno) if errno != 0
spawn_args[0].read_int
end

Expand Down

0 comments on commit 9baec25

Please sign in to comment.