Use TMPDIR environment variable in install script (#35636)
## Summary This PR updates the install script to respect the `TMPDIR` environment variable when creating temporary directories. ## Motivation Some environments have non-standard temporary directory locations or restrictions on `/tmp`. This change allows users to specify an alternative temporary directory by setting the `TMPDIR` environment variable. ## Changes - Check if `TMPDIR` is set and points to a valid directory - Use `$TMPDIR` for temporary files if available - Fall back to `/tmp` if `TMPDIR` is not set or invalid ## Testing Tested the script with: - `TMPDIR` unset (uses `/tmp` as before) - `TMPDIR` set to a valid directory (uses specified directory) - `TMPDIR` set to an invalid path (falls back to `/tmp`) This change maintains backward compatibility while adding flexibility for environments with non-standard temporary directory requirements. Release Notes: - N/A
This commit is contained in:
parent
2c7251e4f9
commit
3bee803b51
1 changed files with 6 additions and 1 deletions
|
@ -9,7 +9,12 @@ main() {
|
|||
platform="$(uname -s)"
|
||||
arch="$(uname -m)"
|
||||
channel="${ZED_CHANNEL:-stable}"
|
||||
temp="$(mktemp -d "/tmp/zed-XXXXXX")"
|
||||
# Use TMPDIR if available (for environments with non-standard temp directories)
|
||||
if [ -n "${TMPDIR:-}" ] && [ -d "${TMPDIR}" ]; then
|
||||
temp="$(mktemp -d "$TMPDIR/zed-XXXXXX")"
|
||||
else
|
||||
temp="$(mktemp -d "/tmp/zed-XXXXXX")"
|
||||
fi
|
||||
|
||||
if [ "$platform" = "Darwin" ]; then
|
||||
platform="macos"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue