From 5aaa35421d709fb5deb5c0bcb718706826bb35d9 Mon Sep 17 00:00:00 2001 From: Songstats Audit Date: Sat, 29 Aug 2026 22:22:26 +0200 Subject: [PATCH] Honor to_io-only redirection wrappers --- lib/childprocess/process_spawn_process.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/childprocess/process_spawn_process.rb b/lib/childprocess/process_spawn_process.rb index 11bd3a6..14f1231 100644 --- a/lib/childprocess/process_spawn_process.rb +++ b/lib/childprocess/process_spawn_process.rb @@ -51,8 +51,8 @@ def launch_process options = {} - options[:out] = io.stdout ? io.stdout.fileno : File::NULL - options[:err] = io.stderr ? io.stderr.fileno : File::NULL + options[:out] = io.stdout ? fileno_for(io.stdout) : File::NULL + options[:err] = io.stderr ? fileno_for(io.stderr) : File::NULL if duplex? reader, writer = ::IO.pipe @@ -100,6 +100,10 @@ def set_exit_code(status) @exit_code = status.exitstatus || status.termsig end + def fileno_for(io) + io.respond_to?(:fileno) ? io.fileno : io.to_io.fileno + end + def send_term send_signal 'TERM' end