co-sh

0.0.4 • Public • Published

sh

Call any shell command like a function using ES 6 Proxies & Generators.

Use node v5.0.x with --harmony-proxies flag, along with

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(ls.stdout)) {
    console.log(buf.toString());
  }
 
  try {
    yield sh.nonexistingcmd();
  } catch(e){
    console.log(e);
  }
})();

Assuming the above code is in a file called test.js run it using;

node --harmony-proxies test.js

See the examples folder for more

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.4
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.4
    0
  • 0.0.3
    0
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i co-sh

Weekly Downloads

0

Version

0.0.4

License

MIT

Last publish

Collaborators

  • bulkan