phar-io / phive

The Phar Installation and Verification Environment (PHIVE)
https://phar.io
BSD 3-Clause "New" or "Revised" License
579 stars 43 forks source link

Phive reports broken pipe when writing to closed standard output (STDOUT) #406

Open ktomk opened 1 year ago

ktomk commented 1 year ago

Phive 0.15.2 (also 0.15.1) is talkative when passing output into head(1) and similar utilities:

$ phive --version | head -n 1
Phive 0.15.2 - Copyright (C) 2015-2023 by Arne Blankerts, Sebastian Heuer and Contributors
[ERROR]   An error occurred while processing your request:

          fwrite(): write of 1 bytes failed with errno=32 Broken pipe

          #0 src/shared/cli/output/ConsoleOutput.php(49)
          #1 unknown file(0): PharIo\Phive\Cli\Runner->errorHandler()
          #2 src/shared/cli/output/ConsoleOutput.php(49): fwrite()
          #3 src/shared/cli/Runner.php(192): PharIo\Phive\Cli\ConsoleOutput->writeText()
          #4 src/shared/cli/Runner.php(242): PharIo\Phive\Cli\Runner->showFooter()
          #5 src/shared/cli/Runner.php(95): PharIo\Phive\Cli\Runner->execute()
          #6 (354): PharIo\Phive\Cli\Runner->run()
          #7 {main}

          Environment: PHP 7.4.33 (on Linux 5.15.0-60-generic)
          Phive Version: 0.15.2

          This should not have happened and is most likely a bug.
          Please report it at https://github.com/phar-io/phive/issues, make sure you include
          the full output of this error message. Thank you!

Reported per request in the message.