[前][次][番号順一覧][スレッド一覧]

ruby-changes:12895

From: akr <ko1@a...>
Date: Sun, 23 Aug 2009 15:15:24 +0900 (JST)
Subject: [ruby-changes:12895] Ruby:r24630 (trunk): * bootstraptest/runner.rb (Dir.mktmpdir): updated to latest.

akr	2009-08-23 15:15:00 +0900 (Sun, 23 Aug 2009)

  New Revision: 24630

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24630

  Log:
    * bootstraptest/runner.rb (Dir.mktmpdir): updated to latest.
      (in_temporary_working_directory): temporary directory name changed.

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/runner.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24629)
+++ ChangeLog	(revision 24630)
@@ -1,3 +1,8 @@
+Sun Aug 23 15:12:22 2009  Tanaka Akira  <akr@f...>
+
+	* bootstraptest/runner.rb (Dir.mktmpdir): updated to latest.
+	  (in_temporary_working_directory): temporary directory name changed.
+	  
 Sun Aug 23 00:56:13 2009  Tanaka Akira  <akr@f...>
 
 	* thread.c (rb_thread_schedule): don't recur infinitely.
@@ -10624,6 +10629,7 @@
 	* random.c (rb_rand_internal): used by Bignum#*.
 
 	* test/ruby/test_bignum.rb: add some tests for above.
+
 Sun Dec 14 01:35:48 2008  Tanaka Akira  <akr@f...>
 
 	* process.c (forked_child): new variable.
Index: bootstraptest/runner.rb
===================================================================
--- bootstraptest/runner.rb	(revision 24629)
+++ bootstraptest/runner.rb	(revision 24630)
@@ -17,13 +17,27 @@
 
 if !Dir.respond_to?(:mktmpdir)
   # copied from lib/tmpdir.rb
-  def Dir.mktmpdir(prefix="d", tmpdir=nil)
+  def Dir.mktmpdir(prefix_suffix=nil, tmpdir=nil)
+    case prefix_suffix
+    when nil
+      prefix = "d"
+      suffix = ""
+    when String
+      prefix = prefix_suffix
+      suffix = ""
+    when Array
+      prefix = prefix_suffix[0]
+      suffix = prefix_suffix[1]
+    else
+      raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
+    end
     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
+      path << suffix
       Dir.mkdir(path, 0700)
     rescue Errno::EEXIST
       n ||= 0
@@ -339,7 +353,7 @@
       yield
     }
   else
-    Dir.mktmpdir("bootstraptest.tmpwd") {|d|
+    Dir.mktmpdir(["bootstraptest", ".tmpwd"]) {|d|
       Dir.chdir(d) {
         yield
       }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]