[build-utils][cli][go][node][ruby][static-build] Explicitly set PATH when copying env vars (#8532)

On Windows 10 and 11 machines, environment variables are not case sensitive. The system PATH is actually defined as `process.env.Path`, however Node.js kindly handles the case sensitivity and will automatically return the system path when specifying `process.env.PATH`.

When we clone the environment variables via `{ ...process.env }`, we lose the automatic resolving of `Path` to `PATH`. To fix this, we need to explicitly copy the `PATH`.

#### Tests

- [x] The code changed/added as part of this PR has been covered with tests
- [x] All tests pass locally with `yarn test-unit`

#### Code Review

- [ ] This PR has a concise title and thorough description useful to a reviewer
- [ ] Issue from task tracker has a link to this PR
This commit is contained in:
Chris Barber
2022-09-14 15:29:52 -05:00
committed by GitHub
parent 6498fd1aab
commit 7ddebb099d
9 changed files with 184 additions and 32 deletions

View File

@@ -16,6 +16,7 @@ import {
createLambda,
debug,
walkParentDirs,
cloneEnv,
} from '@vercel/build-utils';
import { installBundler } from './install-ruby';
@@ -63,12 +64,11 @@ async function bundleInstall(
['install', '--deployment', '--gemfile', gemfilePath, '--path', bundleDir],
{
stdio: 'pipe',
env: {
...process.env,
env: cloneEnv(process.env, {
BUNDLE_SILENCE_ROOT_WARNING: '1',
BUNDLE_APP_CONFIG: bundleAppConfig,
BUNDLE_JOBS: '4',
},
}),
}
);
}