summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-11-07 21:57:24 +0900
committernagachika <nagachika@ruby-lang.org>2025-11-08 14:39:25 +0900
commit269bd157ea7da576ff408a8dfeda8e4485f66a1e (patch)
tree81b4dea4fc9e0c4f48827cd531a3f492cf1852c1
parentbc6f57ac15a99caaaadf1ca45a2c7a7cef85870d (diff)
Use `IO.popen` instead of `IO.foreach` with pipe
-rwxr-xr-xwin32/mkexports.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/win32/mkexports.rb b/win32/mkexports.rb
index 1a9f474be2..44bda94990 100755
--- a/win32/mkexports.rb
+++ b/win32/mkexports.rb
@@ -138,7 +138,11 @@ end
class Exports::Cygwin < Exports
def self.nm
- @@nm ||= RbConfig::CONFIG["NM"]
+ @@nm ||=
+ begin
+ require 'shellwords'
+ RbConfig::CONFIG["NM"].shellsplit
+ end
end
def exports(*)
@@ -146,7 +150,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([*self.class.nm, *%w[--extern-only --defined-only], *objs]) do |f|
+ f.each(&block)
+ end
end
def each_export(objs)