-
Notifications
You must be signed in to change notification settings - Fork 892
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
(At least) Non-interactive commands should write errors to STDERR #2270
Comments
+1 to this. We are using AWS CodeDeploy and have phinx migrations running via a bash script. Because the errors aren't going to stderr the script just happily continues on its way when phinx errors out without triggering any of our error handlers. |
Maybe someone wants to make a PR. I am sure it can be fast tracked. |
I would if I had the slightest clue how any of this works. We don't use Symfony otherwise, so it's a bit of a learning curve to figure out where to even make this happen... would it be in the various commands at this point (using Migrate as an example):
writeln one would use the SymfonyStyle error style per the link in the issue description?
|
I'll try to work on this within the next two days. Originally I thought it was so easy and straightforward that I only created the issue with pointers at the solution path, but then lost track of it. Basically it's merely adding this at the beginning of all command execute methods and then replacing $ouput by $errorStyle whereever output shall be written to STDERR (if available):
(of course SymfonyStyle needs to be imported). |
Right now commands like
migrate
write errors to STDOUT. This is wrong. Errors, especially from commands that are commonly used non-interactively, need to be written to STDERR so that scripts executing Phinx can easily distinguish between information (STDOUT) and errors (STDERR), possibly redirecting either of them to different locations.Here's how:
https://symfony.com/doc/current/console/style.html#writing-to-the-error-output
The text was updated successfully, but these errors were encountered: