diff options
author | Max Romanov <max.romanov@nginx.com> | 2019-11-13 15:53:49 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2019-11-13 15:53:49 +0300 |
commit | bdd96bc9ed7495199b2c826e03c8d65c7588da9d (patch) | |
tree | 046503788364b235f0ca3472f9d8f41dc4d5f5c0 /src/ruby/nxt_ruby.c | |
parent | f2610d216059fd2dfced37442ea4e76f0b88a33b (diff) | |
download | unit-bdd96bc9ed7495199b2c826e03c8d65c7588da9d.tar.gz unit-bdd96bc9ed7495199b2c826e03c8d65c7588da9d.tar.bz2 |
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.
Diffstat (limited to '')
-rw-r--r-- | src/ruby/nxt_ruby.c | 11 |
1 files changed, 7 insertions, 4 deletions
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, |