Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix the monitor

  • Loading branch information...
commit 8d1bdfa47f00c19acb498175e80e65e8ebfc2fea 1 parent 7654993
@substack authored
Showing with 32 additions and 10 deletions.
  1. +4 −4 bin/drone.js
  2. +28 −6 bin/monitor.js
View
8 bin/drone.js
@@ -15,11 +15,11 @@ drone.on('error', function (err) {
console.error(err && err.stack || err);
});
-drone.on('spawn', function (id, opts) {
- emit('spawn', id, opts);
+drone.on('spawn', function (proc) {
+ emit('spawn', proc);
console.log(
- '[' + opts.repo + '.' + opts.commit.slice(8) + '] '
- + opts.command.join(' ')
+ '[' + proc.repo + '.' + proc.commit.slice(8) + '] '
+ + proc.command.join(' ')
);
});
View
34 bin/monitor.js
@@ -10,14 +10,36 @@ p.on('error', function (err) {
p.hub.on('up', function (hub) {
var em = new EventEmitter;
- em.on('spawn', function (id, opts) {
- console.dir([ 'spawn', id, opts ]);
+ em.on('spawn', function (proc) {
+ console.log(
+ '(spawned '
+ + proc.drone + '#' + proc.id
+ + ' : ' + proc.command.join(' ')
+ + ')'
+ );
});
- em.on('stdout', function (buf, opts) {
- if (opts) {
- console.dir([ 'stdout', buf, opts ]);
- }
+ em.on('stdout', function (buf, proc) {
+ console.log(
+ '[' + proc.drone + '#' + proc.id + '] '
+ + buf.replace(/\n$/, '')
+ );
+ });
+
+ em.on('stderr', function (buf, proc) {
+ console.log(
+ '[' + proc.drone + '#' + proc.id + '] '
+ + buf.replace(/\n$/, '')
+ );
+ });
+
+ em.on('exit', function (code, sig, proc) {
+ console.log(
+ '(exited '
+ + proc.drone + '#' + proc.id
+ + ' : ' + proc.command.join(' ')
+ + ')'
+ );
});
hub.subscribe(em.emit.bind(em));
Please sign in to comment.
Something went wrong with that request. Please try again.