Skip to content

Commit 49f341f

Browse files
slootjesjaviereguiluz
authored andcommitted
Add mandatory exit status
Modified all execute() functions and added a note with the new requirement which links to an explanation of exit statuses.
1 parent 1c22d72 commit 49f341f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

console.rst

Lines changed: 5 additions & 0 deletions
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)