bcoe / sandcastle

A simple and powerful sandbox for running untrusted JavaScript.
MIT License
222 stars 48 forks source link

issue && windows 10 #72

Open lionM opened 8 years ago

lionM commented 8 years ago
   const SandCastle = require('sandcastle').SandCastle;
   const sc = new SandCastle({ api:'./api.js', timeout: 100000 });  
   var code = sc.createScript("\
exports.main = function(){\
    exit("+ param +");\
}\
   ");
code.on('timeout',function(err){
        console.log('timeout');
    });
    code.on('exit', function(err, output){
        console.log('in exit');
        if (err) {
            return( err );
        }
        return( output );
    });
    code.run();

****\ api.js in the 'lib' directory

a.if const sc = new SandCastle({ api:'./api.js', timeout: 100000 });
console : return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ Error: ENOENT: no such file or directory, open 'd:\works\nodejs_api\extend_parse_api.js'

b. if const sc = new SandCastle({ api:'./lib/api.js', timeout: 100000 }); is work but always log 'timeout'

c. os: windows 10 , nodejs: v6.2.0 , python: 2.7 , candcastle: 1.3.0