Giter Site home page Giter Site logo

iojs 3.3.0 and Buffer about vm2 HOT 3 CLOSED

patriksimek avatar patriksimek commented on May 16, 2024
iojs 3.3.0 and Buffer

from vm2.

Comments (3)

patriksimek avatar patriksimek commented on May 16, 2024

With Node 4 I get:

check before VM: true
ran VM
check after VM: true true

But there are different issues with Node 4 I have to look into.

from vm2.

rahulpowar avatar rahulpowar commented on May 16, 2024

Yeah, looks like the instanceof check works but things are not quite right with Buffer yet.

const VM = require('vm2').NodeVM;

const buf1 = new Buffer(1);
const bufPre = new Buffer('c3RpbGwgYnJva2Vu', 'base64');
console.log('bufPre out:', bufPre.toString('utf8'), (buf1 instanceof Buffer));

const vm = new VM();
vm.run("console.log('ran VM')");

const buf2 = new Buffer(1);
console.log('check after VM:', (buf2 instanceof Buffer), (buf1 instanceof Buffer));

const bufPost = new Buffer('c3RpbGwgYnJva2Vu', 'base64');
console.log('bufPost out:', bufPost.toString('utf8'));

Node 0.12.7

bufPre out: still broken true
ran VM
check after VM: true true
bufPost out: still broken

Node v4.1.0

bufPre out: still broken true
ran VM
check after VM: true true
buffer.js:536
        return this.base64Write(string, offset, length);
                    ^

TypeError: argument should be a Buffer
    at TypeError (native)
    at Buffer.write (buffer.js:536:21)
    at fromString (buffer.js:106:26)
    at new Buffer (buffer.js:53:12)
    at Object.<anonymous> (/Users/rahul/Downloads/vm2t/vm2-test.js:13:17)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:475:10)

Native call seems to fail the type assertion.

from vm2.

patriksimek avatar patriksimek commented on May 16, 2024

Should be fixed in 0.2.4.

from vm2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.