Permalink
Browse files

pipe stdout directly through instead of using a custom onexit handler

  • Loading branch information...
1 parent 876a64e commit 0a4c3c9b491d32e79cb8e132c110dd09da113a25 @substack committed Apr 5, 2013
Showing with 5 additions and 7 deletions.
  1. +5 −7 lib/info.js
View
@@ -24,7 +24,7 @@ module.exports = function (opts, req, res) {
dup.exists = ex;
if (!ex && self.autoCreate) {
- dup.on('accept', function () {
+ dup.once('accept', function () {
self.create(opts.repo, next);
});
@@ -37,15 +37,16 @@ module.exports = function (opts, req, res) {
res.end('repository not found');
}
else {
- dup.on('accept', next);
+ dup.once('accept', next);
self.emit('info', dup);
if (!anyListeners) dup.accept();
}
});
function next () {
- res.setHeader('content-type',
+ res.setHeader(
+ 'content-type',
'application/x-git-' + opts.service + '-advertisement'
);
noCache(res);
@@ -67,8 +68,5 @@ function serviceRespond (service, file, res) {
'--advertise-refs',
file
]);
- ps.stdout.pipe(res, { end : false });
- ps.stderr.pipe(res, { end : false });
-
- onexit(ps, function () { res.end() });
+ ps.stdout.pipe(res);
}

0 comments on commit 0a4c3c9

Please sign in to comment.