sh
Using Proxies & Generators to run shell commands.
Uses node v0.11.x
with --harmony-proxies --harmony-generators
flags, along with
Install
Use n to install node v0.11.x
n 0.11.13
Usage
var co = require('co');
var read = require('co-read');
var sh = require('co-sh');
co(function *(){
var ls = yield sh.ls();
var buf;
while (buf = yield read(tail.stdout)) {
console.log(buf.toString());
}
try {
yield sh.nonexistingcmd();
} catch(e){
}
})();
Assuming the above code is in a file called test.js
run it using;
node --harmony-proxies --harmony--generators test.js
See the examples folder for more
LICENCE
MIT