Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: support colored output from queue:listen #52223

Closed
wants to merge 3 commits into from

Conversation

Disservin
Copy link

Currently laravel queue jobs do not have colored output when they are run by the artisan queue listener php artisan queue:listen --tries=1 --timeout=1800, php artisan queue:work --once works just fine.

This is due to a symfony change in their dedection algorithm which I think was buggy in the past and returned true incorrectly (if their algorithm is actually wrong again and this is an upstream issue then feel free to close this one). reference: https://github.com/symfony/symfony/blob/7.2/src/Symfony/Component/Console/Output/StreamOutput.php

For subprocess which we are spawning I believe the correct way of handling things is by enabling the tty feature of the process via setTty(true) like someone else described here symfony/symfony#23002.

Enabling this however leads to regressions, since #44971 the queue listener will only print "Processing jobs from the [] queue" once, this done via Terminal::hasSttyAvailable().
The change in enabling the tty again is breaking this detection and as such we need a different way to detect if we need to print the message again, this is handled by the isChildProcess function. If you have better ideas on how to solve this I'm happy to change this part.

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

@Disservin
Copy link
Author

Disservin commented Jul 22, 2024

Do you prefer a bug report instead? There is different behavior between the laravel of now,

image

#44971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants