node-js-libs / node.io

MIT License
1.8k stars 140 forks source link

passing options to node #121

Closed jedahan closed 12 years ago

jedahan commented 12 years ago

I would like to run node-inspector to debug my code, but theres no way to pass along --debug.

running node.io -g myscraper.coffee just prints debug messages to the commandline, it does not help v8-profiler to attach to node-inspector.

Is there something I'm missing?

chriso commented 12 years ago

You can use the nodeio.start(job, options, callback, capture output) function inside a script and then just run that script with the node-inspector.

Here's an example of using start()

var nodeio = require('node.io');

var job = new nodeio.Job({
    input: [ 0, 1, 2 ],
    run: function (num) {
        this.emit(num * 2);
    }
});

nodeio.start(job, { silent: true }, function (err, output) {
    console.log(output);
}, true);