Permalink
Browse files

If posix_spawn or posix_spawnp returns an error, turn that error code…

… into an exception.
  • Loading branch information...
1 parent dce1961 commit 9baec25d165bbb5568f378c62984c27a5d44bc6a @evilrich evilrich committed May 24, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/spoon.rb
View
@@ -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

0 comments on commit 9baec25

Please sign in to comment.