Skip to content

Commit 397bb7e

Browse files
committed
Do not overwrite GEM_PATH if already set
The bundler's test sets the `GEM_PATH` and `GEM_HOME` environment variables by itself. Overwriting them results in tons of errors.
1 parent cd27c58 commit 397bb7e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ruby-runner.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ main(int argc, char **argv)
8484
insert_env_path(LIBPATHENV, builddir, dirsize, 1);
8585
insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
8686

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);
87+
if (!getenv("GEM_PATH")) {
88+
insert_env_path_lit("GEM_PATH", ABS_SRCDIR"/.bundle", 1);
89+
insert_env_path_lit("GEM_PATH", BUILDDIR"/.bundle", 1);
90+
setenv("GEM_HOME", BUILDDIR"/.bundle", 0);
91+
}
9092

9193
if (!(p = strrchr(arg0, '/'))) p = arg0; else p++;
9294
if (strlen(p) < namesize - 1) {

0 commit comments

Comments
 (0)