From 41865bb6712a14ad1fc2e729316b4e2d8452babc Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 7 Nov 2025 21:57:24 +0900 Subject: Use `IO.popen` instead of `IO.foreach` with pipe --- win32/mkexports.rb | 10 ++++++++-- 1 file 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) -- cgit v1.2.3