From bdd96bc9ed7495199b2c826e03c8d65c7588da9d Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 13 Nov 2019 15:53:49 +0300 Subject: Ruby: fixing initialization sequence. There was a change (ruby/ruby@6c70fed) in Ruby 2.6 that moved RUBY_DESCRIPTION global constant definition out of Init_version(). Unit initialized Ruby incorrectly, so the constant was not defined. This closes #330 issue on GitHub. --- src/ruby/nxt_ruby.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/ruby/nxt_ruby.c') diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c index ab9f7020..45d7a7aa 100644 --- a/src/ruby/nxt_ruby.c +++ b/src/ruby/nxt_ruby.c @@ -85,14 +85,16 @@ static nxt_int_t nxt_ruby_init(nxt_task_t *task, nxt_common_app_conf_t *conf) { int state, rc; - VALUE dummy, res; + VALUE res; nxt_unit_ctx_t *unit_ctx; nxt_unit_init_t ruby_unit_init; nxt_ruby_rack_init_t rack_init; + static char *argv[2] = { (char *) "NGINX_Unit", (char *) "-e0" }; + + RUBY_INIT_STACK ruby_init(); - Init_stack(&dummy); - ruby_init_loadpath(); + ruby_options(2, argv); ruby_script("NGINX_Unit"); rack_init.task = task; @@ -707,7 +709,8 @@ nxt_ruby_rack_result_body(VALUE result) } } else if (rb_respond_to(body, rb_intern("each"))) { - rb_iterate(rb_each, body, nxt_ruby_rack_result_body_each, 0); + rb_block_call(body, rb_intern("each"), 0, 0, + nxt_ruby_rack_result_body_each, 0); } else { nxt_unit_req_error(nxt_ruby_run_ctx.req, -- cgit