Skip to content

Commit 0a45d57

Browse files
committed
minor #12730 Add mandatory exit status (slootjes)
This PR was submitted for the 5.0 branch but it was merged into the 4.4 branch instead (closes #12730). Discussion ---------- Add mandatory exit status Since Symfony 5 it is required to return an integer from a command but this is not yet reflected in the documentation. I've modified the execute() functions and added a note with the new requirement which links to an explanation of exit statuses. Commits ------- 49f341f Add mandatory exit status
2 parents 1c22d72 + 49f341f commit 0a45d57

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

console.rst

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ want a command to create a user::
4646
protected function execute(InputInterface $input, OutputInterface $output)
4747
{
4848
// ...
49+
50+
return 0;
4951
}
5052
}
5153

@@ -316,6 +318,7 @@ command:
316318
:method:`Symfony\\Component\\Console\\Command\\Command::execute` *(required)*
317319
This method is executed after ``interact()`` and ``initialize()``.
318320
It contains the logic you want the command to execute.
321+
Must return an integer which will be used as the command `exit status`_.
319322

320323
.. _console-testing-commands:
321324

@@ -395,3 +398,5 @@ tools capable of helping you with different tasks:
395398
* :doc:`/components/console/helpers/formatterhelper`: customize the output colorization
396399
* :doc:`/components/console/helpers/progressbar`: shows a progress bar
397400
* :doc:`/components/console/helpers/table`: displays tabular data as a table
401+
402+
.. _`exit status`: https://en.wikipedia.org/wiki/Exit_status

0 commit comments

Comments
 (0)