Prevent require executing some scripts

This commit is contained in:
Bo Anderson 2022-09-08 01:40:34 +01:00
parent 8a807dcd7a
commit 987abe7773
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
4 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@ if ENV["HOMEBREW_STACKPROF"]
end
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__
std_trap = trap("INT") { exit! 130 } # no backtrace thanks

View File

@ -4,6 +4,8 @@
# This script is loaded by formula_installer as a separate instance.
# Thrown exceptions are propagated back to the parent process over a pipe
raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__
old_trap = trap("INT") { exit! 130 }
require_relative "global"

View File

@ -1,6 +1,8 @@
# typed: strict
# frozen_string_literal: true
raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__
old_trap = trap("INT") { exit! 130 }
require_relative "global"

View File

@ -1,6 +1,8 @@
# typed: false
# frozen_string_literal: true
raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__
old_trap = trap("INT") { exit! 130 }
require_relative "global"