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.
This commit is contained in:
Nobuyoshi Nakada 2025-02-10 18:04:25 +09:00
parent cd27c580fa
commit 397bb7e42c
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-02-10 10:16:58 +00:00

View File

@ -84,9 +84,11 @@ main(int argc, char **argv)
insert_env_path(LIBPATHENV, builddir, dirsize, 1); insert_env_path(LIBPATHENV, builddir, dirsize, 1);
insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0); insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
insert_env_path_lit("GEM_PATH", ABS_SRCDIR"/.bundle", 1); if (!getenv("GEM_PATH")) {
insert_env_path_lit("GEM_PATH", BUILDDIR"/.bundle", 1); insert_env_path_lit("GEM_PATH", ABS_SRCDIR"/.bundle", 1);
if (!getenv("GEM_HOME")) setenv("GEM_HOME", ABS_SRCDIR"/.bundle", 1); insert_env_path_lit("GEM_PATH", BUILDDIR"/.bundle", 1);
setenv("GEM_HOME", BUILDDIR"/.bundle", 0);
}
if (!(p = strrchr(arg0, '/'))) p = arg0; else p++; if (!(p = strrchr(arg0, '/'))) p = arg0; else p++;
if (strlen(p) < namesize - 1) { if (strlen(p) < namesize - 1) {