bug #12032 [Command] Set the process title as late as possible (lyrixx)
This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes #12032).
Discussion
----------
[Command] Set the process title as late as possible
| Q | A
| ------------- | ---
| Bug fix? | yes (so it could be merged into 2.5)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
To be able to customize to process title in the `initialize` method of the
current command with some arguments or options
Commits
-------
44997d3
[Command] Set the process title as late as possible
This commit is contained in:
commit
f94ba9ab43
@ -213,16 +213,6 @@ class Command
|
||||
*/
|
||||
public function run(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (null !== $this->processTitle) {
|
||||
if (function_exists('cli_set_process_title')) {
|
||||
cli_set_process_title($this->processTitle);
|
||||
} elseif (function_exists('setproctitle')) {
|
||||
setproctitle($this->processTitle);
|
||||
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
|
||||
$output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
|
||||
}
|
||||
}
|
||||
|
||||
// force the creation of the synopsis before the merge with the app definition
|
||||
$this->getSynopsis();
|
||||
|
||||
@ -240,6 +230,16 @@ class Command
|
||||
|
||||
$this->initialize($input, $output);
|
||||
|
||||
if (null !== $this->processTitle) {
|
||||
if (function_exists('cli_set_process_title')) {
|
||||
cli_set_process_title($this->processTitle);
|
||||
} elseif (function_exists('setproctitle')) {
|
||||
setproctitle($this->processTitle);
|
||||
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
|
||||
$output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
|
||||
}
|
||||
}
|
||||
|
||||
if ($input->isInteractive()) {
|
||||
$this->interact($input, $output);
|
||||
}
|
||||
|
Reference in New Issue
Block a user