Defer CharacterReader initialization until command execution#1092
Merged
dantleech merged 2 commits intophpbench:masterfrom Apr 10, 2024
Merged
Conversation
Contributor
Author
|
There's a few other ways this could be done e.g. |
dantleech
reviewed
Apr 9, 2024
| * press <return> in order to paginate. | ||
| */ | ||
| public function __construct() | ||
| public function initialize(): void |
Member
There was a problem hiding this comment.
let's make this priate an lazily initialize it when we call read ? this avoids "temporal coupling" and in anycase, it's not a hotpath.
> In FixerFactory.php line 164: [phpdoc_align] Configuration must be an array and may not be empty.
The call to `readline_callback_handler_install` in `CharacterReader` is
causing some junk output (see below) *in all commands* that was
breaking the CSV output. Clearing out `TERM` and `COLORTERM` also
prevents the issue.
This commit defers the installation of the readline callback handler
until log is actually run.
```console
$ COLORTERM="truecolor" TERM="xterm-256color" php -r "readline_callback_handler_install('', function (): void {});" | xxd
00000000: 1b5b 3f32 3030 3468 1b5b 3f32 3030 346c .[?2004h.[?2004l
00000010: 0d .
$ COLORTERM= TERM= php -r "readline_callback_handler_install('', function (): void {});" | xxd
$ COLORTERM="truecolor" TERM="xterm-256color" php -r "" | xxd
```
Fixes phpbench#1090
659d0e0 to
2eb8d6b
Compare
Member
|
thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The call to
readline_callback_handler_installinCharacterReaderis causing some junk output (see below) in all commands that was breaking the CSV output. Clearing outTERMandCOLORTERMalso prevents the issue.This commit defers the installation of the readline callback handler until log is actually run.
Fixes #1090