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

ruby-changes:34360

From: nobu <ko1@a...>
Date: Mon, 16 Jun 2014 14:36:06 +0900 (JST)
Subject: [ruby-changes:34360] nobu:r46441 (trunk): process.c: use UTF-8

nobu	2014-06-16 14:35:59 +0900 (Mon, 16 Jun 2014)

  New Revision: 46441

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

  Log:
    process.c: use UTF-8
    
    * process.c (open): use UTF-8 version function to support
      non-ascii path properly.  [ruby-core:63185] [Bug #9946]

  Modified files:
    trunk/ChangeLog
    trunk/process.c
    trunk/test/ruby/test_process.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46440)
+++ ChangeLog	(revision 46441)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jun 16 14:33:56 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* process.c (open): use UTF-8 version function to support
+	  non-ascii path properly.  [ruby-core:63185] [Bug #9946]
+
 Sat Jun 14 10:54:08 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* array.c (rcombinate0): remove recursion, by looping with indexes
Index: process.c
===================================================================
--- process.c	(revision 46440)
+++ process.c	(revision 46441)
@@ -86,6 +86,12 @@ https://github.com/ruby/ruby/blob/trunk/process.c#L86
 # include <mach/mach_time.h>
 #endif
 
+/* define system APIs */
+#ifdef _WIN32
+#undef open
+#define open	rb_w32_uopen
+#endif
+
 #if defined(HAVE_TIMES) || defined(_WIN32)
 static VALUE rb_cProcessTms;
 #endif
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 46440)
+++ test/ruby/test_process.rb	(revision 46441)
@@ -613,6 +613,16 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L613
     }
   end
 
+  def test_execopts_redirect_nonascii_path
+    bug9946 = '[ruby-core:63185] [Bug #9946]'
+    with_tmpchdir {|d|
+      path = "t-\u{30c6 30b9 30c8 f6}.txt"
+      system(*ECHO["a"], out: path)
+      assert_file.for(bug9946).exist?(path)
+      assert_equal("a\n", File.read(path), bug9946)
+    }
+  end
+
   def test_execopts_redirect_to_out_and_err
     with_tmpchdir {|d|
       ret = system(RUBY, "-e", 'STDERR.print "e"; STDOUT.print "o"', [:out, :err] => "foo")

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

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