lib/php_process.rb in php_process-0.0.5 vs lib/php_process.rb in php_process-0.0.6

- old
+ new

@@ -1,9 +1,10 @@ require "knjrbfw" require "knj/wref" require "base64" require "php-serialize4ruby" +require "open3" #This class starts a PHP-process and proxies various calls to it. It also spawns proxy-objects, which can you can call like they were normal Ruby-objects. #===Examples # php = Php_process.new # print "PID of PHP-process: #{php.func("getmypid")}\n" @@ -39,10 +40,16 @@ #Used for 'create_func'. @callbacks = {} @callbacks_count = 0 @callbacks_mutex = Mutex.new - cmd_str = "/usr/bin/env php5 \"#{File.dirname(__FILE__)}/php_script.php\"" + if @args[:cmd_php] + cmd_str = "#{@args[:cmd_php]} " + else + cmd_str = "/usr/bin/env php5 " + end + + cmd_str << "\"#{File.dirname(__FILE__)}/php_script.php\"" if RUBY_ENGINE == "jruby" pid, @stdin, @stdout, @stderr = IO.popen4(cmd_str) else @stdin, @stdout, @stderr = Open3.popen3(cmd_str) \ No newline at end of file