Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
ktomk opened this issue Feb 14, 2023 · 0 comments
Open
Assignees
Labels

Comments

@ktomk
Copy link

ktomk commented Feb 14, 2023

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.

  • Workaround:

    phive ... 2>/dev/null | head -n 1
              ###########
    
  • Additional Info:

    IMHO the warning is not necessary in this case. I could not find any verbose or quiet switches, no idea how this is handled on utility level. I normally allow failures writing to standard output ignoring broken pipe if it was available at initialization (e.g. @fwrite(STDOUT, ...)), YMMV.

@ktomk ktomk changed the title Phive reports broken pipe when stdout closes Phive reports broken pipe when writing to closed standard output (STDOUT) Feb 14, 2023
@theseer theseer self-assigned this Feb 14, 2023
@theseer theseer added the bug label Feb 14, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants