* Use IO::Handles instead of old school filehandles. This ensures
that the pipe gets closed, and the child process dies, if the HTTP connection is prematurely interrupted.
This commit is contained in:
@ -11,10 +11,9 @@ sub process {
|
||||
|
||||
my @storePaths = @{$c->stash->{storePaths}};
|
||||
|
||||
open(OUTPUT, "nix-store --export `nix-store -qR @storePaths` | gzip |");
|
||||
|
||||
my $fh = new IO::Handle;
|
||||
$fh->fdopen(fileno(OUTPUT), "r") or die;
|
||||
|
||||
open $fh, "nix-store --export `nix-store -qR @storePaths` | gzip |";
|
||||
|
||||
$c->response->body($fh);
|
||||
|
||||
|
Reference in New Issue
Block a user