mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bootstraptest/runner.rb (in_temporary_working_directory): use
Dir.mktmpdir to create and remove temporary directory. (Dir.mktmpdir): define if not available. [ruby-dev:31431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4675be9a65
commit
82a9ca296b
2 changed files with 49 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
Fri Aug 17 14:38:36 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bootstraptest/runner.rb (in_temporary_working_directory): use
|
||||
Dir.mktmpdir to create and remove temporary directory.
|
||||
(Dir.mktmpdir): define if not available.
|
||||
[ruby-dev:31431]
|
||||
|
||||
Fri Aug 17 03:07:37 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* compile.c (iseq_compile_each): fix thorw insn option of next.
|
||||
|
|
|
@ -13,10 +13,38 @@ rescue LoadError
|
|||
retry
|
||||
end
|
||||
|
||||
if !Dir.respond_to?(:mktmpdir)
|
||||
# copied from lib/tmpdir.rb
|
||||
def Dir.mktmpdir(prefix="d", tmpdir=nil)
|
||||
tmpdir ||= Dir.tmpdir
|
||||
t = Time.now.strftime("%Y%m%d")
|
||||
n = nil
|
||||
begin
|
||||
path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
||||
path << "-#{n}" if n
|
||||
Dir.mkdir(path, 0700)
|
||||
rescue Errno::EEXIST
|
||||
n ||= 0
|
||||
n += 1
|
||||
retry
|
||||
end
|
||||
|
||||
if block_given?
|
||||
begin
|
||||
yield path
|
||||
ensure
|
||||
FileUtils.remove_entry_secure path
|
||||
end
|
||||
else
|
||||
path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def main
|
||||
@ruby = File.expand_path('miniruby')
|
||||
@verbose = false
|
||||
dir = File.join(Dir.tmpdir, 'bootstraptest.tmpwd')
|
||||
dir = nil
|
||||
quiet = false
|
||||
tests = nil
|
||||
ARGV.delete_if {|arg|
|
||||
|
@ -176,11 +204,19 @@ def error(msg, additional_message)
|
|||
end
|
||||
|
||||
def in_temporary_working_directory(dir)
|
||||
FileUtils.rm_rf dir
|
||||
Dir.mkdir dir
|
||||
Dir.chdir(dir) {
|
||||
yield
|
||||
}
|
||||
if dir
|
||||
FileUtils.rm_rf dir
|
||||
Dir.mkdir dir
|
||||
Dir.chdir(dir) {
|
||||
yield
|
||||
}
|
||||
else
|
||||
Dir.mktmpdir("bootstraptest.tmpwd") {|d|
|
||||
Dir.chdir(d) {
|
||||
yield
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def cleanup_coredump
|
||||
|
|
Loading…
Reference in a new issue