how can I load a file while $SAFE = 1
I am attempting to get the following to work
fi开发者_运维问答lename = File.expand_path("./script")
filename.taint
$SAFE = 1
load(filename)
From what I understand this should work based on the ruby documentation. However I receive
`load': Insecure operation - load (SecurityError)
I am obviously missing something but I can't figure out what it is.
Turns out I didn't pay enough attention to the documentation
filename = File.expand_path("./script.rb")
puts filename.untaint
$SAFE = 1
load(filename)
精彩评论