From 883d9c305f82b23fbe0ed28e9d74461cc5e13b97 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 25 Oct 2022 16:07:09 +0900 Subject: [PATCH] [ruby/tmpdir] Found or raise --- lib/tmpdir.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb index 3e76a8f5c3..95d4ca3fce 100644 --- a/lib/tmpdir.rb +++ b/lib/tmpdir.rb @@ -19,7 +19,7 @@ class Dir # Returns the operating system's temporary file path. def self.tmpdir - tmp = ['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @@systmpdir], ['/tmp']*2, ['.']*2].find do |name, dir = ENV[name]| + ['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @@systmpdir], ['/tmp']*2, ['.']*2].find do |name, dir = ENV[name]| next if !dir dir = File.expand_path(dir) stat = File.stat(dir) rescue next @@ -33,9 +33,7 @@ class Dir else break dir end - end - raise ArgumentError, "could not find a temporary directory" unless tmp - tmp + end or raise ArgumentError, "could not find a temporary directory" end # Dir.mktmpdir creates a temporary directory.