Skip to content

Instantly share code, notes, and snippets.

@juliangruber juliangruber/gist:5071867
Last active Dec 14, 2015

Embed
What would you like to do?
horst api

horst

Usage

Create a server that listens for hosts:

var horst = require('horst');
var hub = horst();

hub.on('ps', function (ps) {
  // meta object
  assert(ps.meta == 'foo');
  
  // stdin, stdout and stderr
  ps.stdin.write('hey');
  ps.stdout.pipe(process.stdout, { end : false });
  ps.stderr.pipe(process.stderr, { end : false });
  
  // events
  ps.on('exit', function (code) {});
  ps.on('close', function () {});
  ps.on('respawn', function () {});

  // misc
  ps.kill(signal);
  console.log(ps.pid);
});

hub.listen(7000);

And spawn a process from javascript

hub.spawn('node', ['index.js'], { meta : 'foo' });

or with the horst executable:

$ horst --hub=localhost:7000 --meta=foo -- node index.js

API

var hub = host()

hub.on('ps', fn(ps) {})

hub.listen(port)

hub.spawn(proc, args, opts)

CLI

$ host --help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.