开发者

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜