git ssb

0+

cel / pull-git-remote-helper



Commit 4a1283c958a5ddcc50da3e75ed1c3c71b0236c56

Improve handling stream ending

Charles Lehner committed on 2/19/2016, 3:19:19 PM
Parent: 9bfd8551bbfc41059d347102b284dc7e828d99d4

Files changed

index.jschanged
index.jsView
@@ -79,9 +79,9 @@
7979
8080 // read upload request (wants list) from client
8181 var readWant = lines.wants()
8282 readWant(null, function (end, want) {
83- if (end === true) return // early client disconnect
83+ if (end === true) return cb(true) // early client disconnect
8484 else if (end) cb(end)
8585 else nextWant(null, want)
8686 })
8787 function nextWant(end, want) {
@@ -294,8 +294,9 @@
294294 pull(
295295 lines.updates,
296296 pull.collect(function (err, updates) {
297297 if (err) return cb(err)
298+ if (updates.length === 0) return cb(true)
298299 repo.update(pull.values(updates), pull(
299300 lines.passthrough,
300301 pack.decode(options, repo, done())
301302 ), done())
@@ -401,11 +402,12 @@
401402 // HACK: silence error when writing to closed stream
402403 try {
403404 cb(null, data)
404405 } catch(e) {
405- if (e.message == 'process.stdout cannot be closed.')
406+ if (e.message == 'process.stdout cannot be closed.'
407+ || e.message == 'This socket is closed.')
406408 process.exit(1)
407- else throw e
409+ throw e
408410 }
409411 }
410412 })
411413 }

Built with git-ssb-web