diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-04-21 10:53:53 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-04-21 22:24:55 +0900 |
commit | de5cd5a635e3b975ca7acc5caf0363f2811abd95 (patch) | |
tree | 71b2c2485d803f245f96b8b8ab3e52ba1483ce5a /tool | |
parent | e956052fa953d7e312a2f524127b2ac6ae1b0da2 (diff) |
Use shorter path as `SPEC_TEMP_DIR`
The temporary directory under the build directory may be too long as a
UNIX socket path. On macOS, the default `TMPDIR` per user is also
very long.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7749
Diffstat (limited to 'tool')
-rw-r--r-- | tool/rubyspec_temp.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tool/rubyspec_temp.rb b/tool/rubyspec_temp.rb new file mode 100644 index 0000000000..339bfce211 --- /dev/null +++ b/tool/rubyspec_temp.rb @@ -0,0 +1,13 @@ +require "tmpdir" +require "fileutils" + +if (tmpdir = Dir.mktmpdir("rubyspec_temp.")).size > 80 + # On macOS, the default TMPDIR is very long, inspite of UNIX socket + # path length is limited. + Dir.rmdir(tmpdir) + tmpdir = Dir.mktmpdir("rubyspec_temp.", "/tmp") +end +# warn "tmpdir(#{tmpdir.size}) = #{tmpdir}" +END {FileUtils.rm_rf(tmpdir)} + +ENV["TMPDIR"] = ENV["SPEC_TEMP_DIR"] = tmpdir |