[#19261] lstripped here-document (Re: comments and continuing strings on the next line) — nobu.nakada@...

なかだです。

29 messages 2003/01/01
[#19360] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "K.Kosako" <kosako@...> 2003/01/15

nobu.nakada@nifty.ne.jpさんの

[#19361] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "NAKAMURA, Hiroshi" <nakahiro@...> 2003/01/15

なひです。

[#19364] Re: lstripped here-document (Re: comments and continuing strings on the next line) — nobu.nakada@... 2003/01/17

なかだです。

[#19366] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "NAKAMURA, Hiroshi" <nakahiro@...> 2003/01/17

なひです。

[#19299] [BUG] errno == 0 — Kazuhiro Yoshida <moriq@...>

もりきゅうです。win32だけかもしれません。

22 messages 2003/01/04
[#19301] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19302] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19303] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19304] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19306] Re: [BUG] errno == 0 — nobu.nakada@... 2003/01/05

なかだです。

[ruby-dev:19373] Re: shebang line of bin/*

From: "U.Nakamura" <usa@...>
Date: 2003-01-17 08:11:33 UTC
List: ruby-dev #19373
こんにちは、なかむら(う)です。

In message "[ruby-dev:19372] Re: shebang line of bin/*"
    on Jan.17,2003 16:32:37, <nobu.nakada@nifty.ne.jp> wrote:
| # そういえば、なんでopenのブロックの中でわざわざcloseしてるんだ
| # ろう。

以降もう触らないけど、closeされるまでの間に別の処理が入るか
らcloseしておこう、ということですかね。

で、それはそれとして、このパッチだとmswin32/mingw32/bccwin32
でエラーになるのと、これらのプラットフォームではshebang行じゃ
なくて別のところが問題となるので、それらを修正したパッチです。
([ruby-dev:19372]を含みます)

Index: instruby.rb
===================================================================
RCS file: /home/cvs/ruby/instruby.rb,v
retrieving revision 1.19.1002.6
diff -u -1 -p -w -r1.19.1002.6 instruby.rb
--- instruby.rb	2003/01/05 08:42:12	1.19.1002.6
+++ instruby.rb	2003/01/17 08:05:50
@@ -51,3 +51,5 @@ makedirs [bindir, libdir, rubylibdir, ar
 
-install ruby_install_name+exeext, File.join(bindir, ruby_install_name+exeext), 0755
+ruby_bin = File.join(bindir, ruby_install_name)
+
+install ruby_install_name+exeext, ruby_bin+exeext, 0755
 if rubyw_install_name and !rubyw_install_name.empty?
@@ -83,6 +85,11 @@ for src in Dir["bin/*"]
 
+  next if $dryrun
+
+  shebang = ''
+  body = ''
   open(dest, "r+") { |f|
-    shebang = f.gets.sub(/ruby/, ruby_install_name)
+    shebang = f.gets
     body = f.read
 
+    if shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_bin}
     f.rewind
@@ -90,5 +97,7 @@ for src in Dir["bin/*"]
     f.truncate(f.pos)
-    f.close
+    end
+  }
 
     if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
+    ruby_bin_dosish = ruby_bin.gsub(Regexp.compile(File::SEPARATOR), File::ALT_SEPARATOR)
       open(dest + ".bat", "w") { |b|
@@ -97,6 +106,6 @@ for src in Dir["bin/*"]
 if "%OS%" == "Windows_NT" goto WinNT
-ruby -Sx "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+#{ruby_bin_dosish} -Sx "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
 goto endofruby
 :WinNT
-ruby -Sx "%~nx0" %*
+#{ruby_bin_dosish} -Sx "%~nx0" %*
 goto endofruby
@@ -108,3 +117,2 @@ EOF
     end
-  } unless $dryrun
 end

それでは。
--
U.Nakamura <usa@osb.att.ne.jp>



In This Thread