[racket] simple sandboxing

From: Noel Welsh (noelwelsh at gmail.com)
Date: Mon Feb 7 08:10:03 EST 2011

Maybe this will help:

beginner.rkt

#lang racket

(define foo "o hai")


eval.rkt

#lang racket

(require racket/sandbox)

(define beginner-file-path
  (build-path (current-directory) "beginner.rkt"))

(sandbox-path-permissions
 (list
 (list 'read
       (current-directory))))

(define beginner-evaluator
 (make-module-evaluator beginner-file-path))


test at the REPL:

Welcome to Racket v5.0.99.6.
> (enter! "eval.rkt")
> (beginner-evaluator 'foo)
"o hai"



N.


On Fri, Jan 28, 2011 at 11:32 PM, Caner Derici <canerderici at gmail.com> wrote:
> Hi all,
>
> I wanted to play with sandboxes(for the first time) and tried to write
> down a simple program which reads a source file (.rkt) and evaluates it
> in a sandbox.
...


Posted on the users mailing list.