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

ruby-changes:53957

From: naruse <ko1@a...>
Date: Tue, 4 Dec 2018 09:40:54 +0900 (JST)
Subject: [ruby-changes:53957] naruse:r66177 (trunk): Use getent and cut on Solaris to get home directory

naruse	2018-12-04 09:40:49 +0900 (Tue, 04 Dec 2018)

  New Revision: 66177

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

  Log:
    Use getent and cut on Solaris to get home directory

  Modified files:
    trunk/spec/ruby/core/dir/home_spec.rb
Index: spec/ruby/core/dir/home_spec.rb
===================================================================
--- spec/ruby/core/dir/home_spec.rb	(revision 66176)
+++ spec/ruby/core/dir/home_spec.rb	(revision 66177)
@@ -14,9 +14,15 @@ describe "Dir.home" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/dir/home_spec.rb#L14
     Dir.home.should == home_directory
   end
 
-  platform_is_not :windows do
+  platform_is :solaris do
     it "returns the named user's home directory, from the user database, as a string if called with an argument" do
-      Dir.home(ENV['USER']).should == `/bin/echo ~#{ENV['USER']}`.chomp
+      Dir.home(ENV['USER']).should == `getent passwd ~#{ENV['USER']}|cut -d: -f6`.chomp
+    end
+  end
+
+  platform_is_not :windows, :solaris do
+    it "returns the named user's home directory, from the user database, as a string if called with an argument" do
+      Dir.home(ENV['USER']).should == `echo ~#{ENV['USER']}`.chomp
     end
   end
 

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

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