From 0e6ddfc0acedabf2dce5357b0428fe22f540e876 Mon Sep 17 00:00:00 2001 From: Craig Gumbley Date: Fri, 31 Mar 2023 17:02:38 +0100 Subject: [PATCH] Update msvcrt_name This commit updates msvcrt_name to return the value of RUBY_SO_NAME or ucrtbase. Change taken from #182. --- lib/childprocess/windows.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/childprocess/windows.rb b/lib/childprocess/windows.rb index 1470a7a..957c402 100644 --- a/lib/childprocess/windows.rb +++ b/lib/childprocess/windows.rb @@ -12,20 +12,12 @@ module Lib extend FFI::Library def self.msvcrt_name - host_part = RbConfig::CONFIG['host_os'].split("_")[1] - manifest = File.join(RbConfig::CONFIG['bindir'], 'ruby.exe.manifest') - - if host_part && host_part.to_i > 80 && File.exists?(manifest) - "msvcr#{host_part}" - else - "msvcrt" - end + RbConfig::CONFIG['RUBY_SO_NAME'][/msvc\w+/] || 'ucrtbase' end ffi_lib "kernel32", msvcrt_name ffi_convention :stdcall - end # Library end # Windows end # ChildProcess