summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-11-07 21:57:24 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2026-01-13 16:23:44 +0900
commit3254d2be91971a06ec7f852b0dd2c7659181d2d0 (patch)
tree83553d9cf86dd18623b64de698ef3b40e46f1af5
parent8f8f8d12b9e0efe814aecb24bcf718f099790d1e (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 a69ba528d4..f099f621e5 100755
--- a/win32/mkexports.rb
+++ b/win32/mkexports.rb
@@ -144,7 +144,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(*)
@@ -152,7 +156,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)