Skip to content

Commit

Permalink
Fix downloading on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 26, 2020
1 parent 2d8dcd1 commit 8a7ae4f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Command/FixerApplication.php
Expand Up @@ -372,12 +372,10 @@ private function downloadPhar(
$progressBar->setMessage(sprintf('%.2f MB', $totalSize / 1000000), 'fileSize');
$progressBar->start($totalSize);

$destination = new \React\Stream\WritableResourceStream($pharPathResource, $loop);
$body->pipe($destination);

$bytes = 0;
$body->on('data', static function ($chunk) use ($progressBar, &$bytes): void {
$body->on('data', static function ($chunk) use ($pharPathResource, $progressBar, &$bytes): void {
$bytes += strlen($chunk);
fwrite($pharPathResource, $chunk);
$progressBar->setProgress($bytes);
});
});
Expand Down

0 comments on commit 8a7ae4f

Please sign in to comment.