Merge pull request #15586 from Bo98/text-executable-regex

extend/pathname: fix `text_executable?` regex
This commit is contained in:
Bo Anderson 2023-06-25 19:28:38 +01:00 committed by GitHub
commit bb23116d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -271,7 +271,7 @@ class Pathname
# @private
sig { returns(T::Boolean) }
def text_executable?
/^#!\s*\S+/.match?(open("r") { |f| f.read(1024) })
/\A#!\s*\S+/.match?(open("r") { |f| f.read(1024) })
end
sig { returns(String) }