summaryrefslogtreecommitdiff
path: root/tool/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-04-22 09:56:47 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-04-22 09:56:47 +0900
commite59da9c3393bf054de96e3e828aa2ba5b7286ce5 (patch)
treea6a101ee2608db1f697141e0041b5fbf08fb6b47 /tool/lib
parent9b580ee7b6cb0bebf977a7cd50285ba48b671e87 (diff)
Windows does not have "/tmp" path usually
Diffstat (limited to 'tool/lib')
-rw-r--r--tool/lib/_tmpdir.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/tool/lib/_tmpdir.rb b/tool/lib/_tmpdir.rb
index eac83e2a8a..a238ea467e 100644
--- a/tool/lib/_tmpdir.rb
+++ b/tool/lib/_tmpdir.rb
@@ -2,9 +2,11 @@ require "tmpdir"
require "fileutils"
template = "rubytest."
-if (tmpdir = Dir.mktmpdir(template)).size > 50
+if (tmpdir = Dir.mktmpdir(template)).size > 50 and File.directory?("/tmp")
# On macOS, the default TMPDIR is very long, inspite of UNIX socket
# path length is limited.
+ # On Windows, UNIX socket is not available and no need to shorten
+ # TMPDIR, otherwise assume "/tmp" always exists.
Dir.rmdir(tmpdir)
tmpdir = Dir.mktmpdir(template, "/tmp")
end