Skip to content

Commit 9baa0f8

Browse files
committed
Enable bundled gems in ruby-runner
1 parent adbf9c5 commit 9baa0f8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ruby-runner.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ insert_env_path(const char *envname, const char *paths, size_t size, int prepend
6060
setenv(envname, env, 1);
6161
}
6262

63+
#define insert_env_path_lit(env, path, prep) \
64+
insert_env_path(env, path, sizeof(path), prep)
65+
6366
#define EXTOUT_DIR BUILDDIR"/"EXTOUT
6467
int
6568
main(int argc, char **argv)
@@ -81,6 +84,10 @@ main(int argc, char **argv)
8184
insert_env_path(LIBPATHENV, builddir, dirsize, 1);
8285
insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
8386

87+
insert_env_path_lit("GEM_PATH", ABS_SRCDIR"/.bundle", 1);
88+
insert_env_path_lit("GEM_PATH", BUILDDIR"/.bundle", 1);
89+
if (!getenv("GEM_HOME")) setenv("GEM_HOME", ABS_SRCDIR"/.bundle", 1);
90+
8491
if (!(p = strrchr(arg0, '/'))) p = arg0; else p++;
8592
if (strlen(p) < namesize - 1) {
8693
argv[0] = malloc(p - arg0 + namesize);

test/ruby/test_process.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_overwrite_ENV
275275
end;
276276
end
277277

278-
MANDATORY_ENVS = %w[RUBYLIB RJIT_SEARCH_BUILD_DIR]
278+
MANDATORY_ENVS = %w[RUBYLIB GEM_HOME GEM_PATH RJIT_SEARCH_BUILD_DIR]
279279
case RbConfig::CONFIG['target_os']
280280
when /linux/
281281
MANDATORY_ENVS << 'LD_PRELOAD'

0 commit comments

Comments
 (0)