1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/lib/puma/jruby_restart.rb
2013-03-18 22:06:16 -07:00

22 lines
447 B
Ruby

require 'ffi'
module Puma
module JRubyRestart
extend FFI::Library
ffi_lib 'c'
attach_function :execlp, [:string, :varargs], :int
attach_function :chdir, [:string], :int
def self.chdir_exec(dir, argv)
chdir(dir)
cmd = argv.first
argv = ([:string] * argv.size).zip(argv).flatten
argv << :string
argv << nil
execlp(cmd, *argv)
raise SystemCallError.new(FFI.errno)
end
end
end