Created
February 20, 2012 16:15
-
-
Save ichernev/1869953 to your computer and use it in GitHub Desktop.
sandboxed-module & coffee-script issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir tmp; cd tmp | |
cat > sandbox.coffee <<EOF! | |
x = require 'foo' | |
exports.do = -> | |
console.log x.foo | |
EOF! | |
cat > test_sandbox.coffee <<EOF! | |
require 'coffee-script' | |
sandboxedModule = require 'sandboxed-module' | |
s = sandboxedModule.require './sandbox', | |
requires: | |
'foo': | |
foo: "Injected foo" | |
s.do() | |
EOF! | |
run() { | |
echo "$@" | |
"$@" | |
} | |
echo "make sure you have installed coffee-script and sandboxed-module" | |
npm install coffee-script # either install globally or put ./node_modules/.bin to PATH | |
npm install sandboxed-module | |
echo | |
echo "This fails on node v0.6.9" | |
rm -f sandbox.js | |
run coffee test_sandbox.coffee | |
echo | |
run coffee -c sandbox.coffee | |
echo "This should print 'Injected foo'" | |
run coffee test_sandbox.coffee |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment