| ... | ... |
@@ -35,10 +35,10 @@ |
| 35 | 35 |
# Write |
| 36 | 36 |
my $s = IO::Select->new($cout, $cerr); |
| 37 | 37 |
my $buffer_size = $ENV{GITPREP_SMART_HTTP_BUFFER_SIZE};
|
| 38 |
- my $cb; |
|
| 39 | 38 |
my $error; |
| 40 | 39 |
my $output; |
| 41 | 40 |
my @ready; |
| 41 |
+ my $cb; |
|
| 42 | 42 |
$cb = sub {
|
| 43 | 43 |
my $c = shift; |
| 44 | 44 |
if (@ready = $s->can_read) {
|
| ... | ... |
@@ -55,14 +55,14 @@ |
| 55 | 55 |
$output .= $buf; |
| 56 | 56 |
} |
| 57 | 57 |
} |
| 58 |
- $s->remove($handle) if eof($handle); |
|
| 58 |
+ else {
|
|
| 59 |
+ $s->remove($handle); |
|
| 60 |
+ } |
|
| 59 | 61 |
} |
| 60 | 62 |
$c->write_chunk($output, $cb); |
| 61 | 63 |
} |
| 62 | 64 |
else {
|
| 63 | 65 |
$c->finish; |
| 64 |
- close $cout; |
|
| 65 |
- close $cerr; |
|
| 66 | 66 |
waitpid($pid, 0); |
| 67 | 67 |
app->log->error(url_for . ": $error") if defined $error; |
| 68 | 68 |
undef $cb; |