diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-07-31 16:45:09 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2025-11-08 14:37:54 +0900 |
| commit | dd9163d468fc2997f2ef69f05d620f2649d23cbd (patch) | |
| tree | ed1ba10b4edb89cd8fbd5fdfe39b3a8a856ae614 | |
| parent | 5434aa3f7e8a243ae72fae4675991dc07cccc39f (diff) | |
Win: Strip CRs from `cpp` and `nm` output
The combination of mingw tools and cygin/msys2 ruby leaves CRs.
| -rw-r--r-- | template/fake.rb.in | 1 | ||||
| -rwxr-xr-x | win32/mkexports.rb | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/template/fake.rb.in b/template/fake.rb.in index 5e52d95594..e7a72ac2e5 100644 --- a/template/fake.rb.in +++ b/template/fake.rb.in @@ -9,6 +9,7 @@ while /\A(\w+)=(.*)/ =~ ARGV[0] end if inc = arg['i'] src = inc == '-' ? STDIN.read : File.read(inc) + src.tr!("\r", " ") src.gsub!(/^#.*\n/, '') else src = "" diff --git a/win32/mkexports.rb b/win32/mkexports.rb index 389b49def8..97939cdd09 100755 --- a/win32/mkexports.rb +++ b/win32/mkexports.rb @@ -146,7 +146,9 @@ class Exports::Cygwin < Exports end def each_line(objs, &block) - IO.foreach("|#{self.class.nm} --extern-only --defined-only #{objs.join(' ')}", &block) + IO.popen(%W[#{self.class.nm} --extern-only --defined-only] + objs) do |f| + f.each(&block) + end end def each_export(objs) @@ -155,7 +157,7 @@ class Exports::Cygwin < Exports re = /\s(?:(T)|[[:upper:]])\s#{symprefix}((?!#{PrivateNames}).*)$/ objdump(objs) do |l| next if /@.*@/ =~ l - yield $2, !$1 if re =~ l + yield $2.strip, !$1 if re =~ l end end end |
