Enable bundled gems in ruby-runner

This commit is contained in:
Nobuyoshi Nakada 2025-02-06 23:12:03 +09:00
parent adbf9c5b36
commit 9baa0f8c8c
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-02-06 14:57:20 +00:00
2 changed files with 8 additions and 1 deletions

View File

@ -60,6 +60,9 @@ insert_env_path(const char *envname, const char *paths, size_t size, int prepend
setenv(envname, env, 1);
}
#define insert_env_path_lit(env, path, prep) \
insert_env_path(env, path, sizeof(path), prep)
#define EXTOUT_DIR BUILDDIR"/"EXTOUT
int
main(int argc, char **argv)
@ -81,6 +84,10 @@ main(int argc, char **argv)
insert_env_path(LIBPATHENV, builddir, dirsize, 1);
insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
insert_env_path_lit("GEM_PATH", ABS_SRCDIR"/.bundle", 1);
insert_env_path_lit("GEM_PATH", BUILDDIR"/.bundle", 1);
if (!getenv("GEM_HOME")) setenv("GEM_HOME", ABS_SRCDIR"/.bundle", 1);
if (!(p = strrchr(arg0, '/'))) p = arg0; else p++;
if (strlen(p) < namesize - 1) {
argv[0] = malloc(p - arg0 + namesize);

View File

@ -275,7 +275,7 @@ class TestProcess < Test::Unit::TestCase
end;
end
MANDATORY_ENVS = %w[RUBYLIB RJIT_SEARCH_BUILD_DIR]
MANDATORY_ENVS = %w[RUBYLIB GEM_HOME GEM_PATH RJIT_SEARCH_BUILD_DIR]
case RbConfig::CONFIG['target_os']
when /linux/
MANDATORY_ENVS << 'LD_PRELOAD'