From 357406da8b463978b6db68ef5672b76067506c64 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Wed, 22 Sep 2021 18:14:13 +0900 Subject: [PATCH] [ruby/reline] Use `unpack1` instead of `unpack(template)[0]` https://github.com/ruby/reline/commit/45aa367616 --- lib/reline/terminfo.rb | 2 +- lib/reline/windows.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reline/terminfo.rb b/lib/reline/terminfo.rb index d78f3d7b17..3f32a5aab0 100644 --- a/lib/reline/terminfo.rb +++ b/lib/reline/terminfo.rb @@ -71,7 +71,7 @@ module Reline::Terminfo def self.setupterm(term, fildes) errret_int = String.new("\x00" * 8, encoding: 'ASCII-8BIT') ret = @setupterm.(term, fildes, errret_int) - errret = errret_int.unpack('i')[0] + errret = errret_int.unpack1('i') case ret when 0 # OK 0 diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb index 642f33aedf..5bbf1e9d57 100644 --- a/lib/reline/windows.rb +++ b/lib/reline/windows.rb @@ -184,7 +184,7 @@ class Reline::Windows # DWORD FileNameLength; # WCHAR FileName[1]; # } FILE_NAME_INFO - len = p_buffer[0, 4].unpack("L")[0] + len = p_buffer[0, 4].unpack1("L") name = p_buffer[4, len].encode(Encoding::UTF_8, Encoding::UTF_16LE, invalid: :replace) # Check if this could be a MSYS2 pty pipe ('\msys-XXXX-ptyN-XX')