Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
(maint) Merge up 5329fd3 to master
Browse files Browse the repository at this point in the history
Generated by CI

* commit '5329fd3e2461d6c2d454c72f3b2620e538e09034':
  (LTH-163) Call ruby_sysinit to initialize sockets
  (packaging) Bump to version '1.6.2' [no-promote]
  (packaging) Bump to version '1.5.6' [no-promote]
  • Loading branch information
puppetlabs-jenkins committed Aug 10, 2019
2 parents df19902 + 5329fd3 commit 099e8a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions ruby/inc/leatherman/ruby/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ namespace leatherman { namespace ruby {
// Imported Ruby functions that should not be called externally
int (* const ruby_setup)();
void (* const ruby_init)();
void (* const ruby_sysinit)(int*, char***);
void* (* const ruby_options)(int, char**);
int (* const ruby_cleanup)(volatile int);

Expand Down
20 changes: 14 additions & 6 deletions ruby/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace leatherman { namespace ruby {
LOAD_SYMBOL(rb_eLoadError),
LOAD_OPTIONAL_SYMBOL(ruby_setup),
LOAD_SYMBOL(ruby_init),
LOAD_SYMBOL(ruby_sysinit),
LOAD_SYMBOL(ruby_options),
LOAD_SYMBOL(ruby_cleanup),
_library(move(library))
Expand Down Expand Up @@ -157,13 +158,13 @@ namespace leatherman { namespace ruby {
}

if (_library.first_load()) {
// Run an empty script evaluation
// ruby_options is a required call as it sets up some important stuff (unfortunately)
char const* opts[] = {
"ruby",
"-e",
""
// Calling ruby_sysinit to initialize windows sockets due to the change in
// https://github.com/ruby/ruby/commit/e33b1690d06f867e45750bd8e3e8b06d78b5bc26
int sysinit_opts_size = 1;
char const* sysinit_opts[] = {
"ruby"
};
ruby_sysinit(&sysinit_opts_size, reinterpret_cast<char***>(&sysinit_opts));

// Check for bundler; this is the only ruby option we support
string ruby_opt;
Expand All @@ -174,6 +175,13 @@ namespace leatherman { namespace ruby {
environment::set("RUBYOPT", "");
}

// Run an empty script evaluation
// ruby_options is a required call as it sets up some important stuff (unfortunately)
char const* opts[] = {
"ruby",
"-e",
""
};
ruby_options(sizeof(opts) / sizeof(opts[0]), const_cast<char**>(opts));
}

Expand Down

0 comments on commit 099e8a1

Please sign in to comment.