HIJACK victim hijacker


Cause all existing references to an ACTION! to invoke another ACTION! HIJACK is an ACTION!

RETURNS: [ action!]

The hijacked action value, null if self-hijack (no-op)


victim [action! word! path!] Action value whose references are to be affected. hijacker [action! word! path!] The action to run in its place


We want to stop read from reading outside the current directory

; disable read outside current directory
old-read: copy :read
hijack 'read adapt 'old-read [
    if file? :source [
        source: clean-path source
        if not find source what-dir [
            fail "Not allowed to read outside the jail!"

Example taken from eval used for safe evaluation of a rebol word passed by CGI

Trello card

Last Updated: 1/16/2020, 8:26:06 PM