8000 bug #18814 Fixed server status command when port has been omitted (pe… · symfony/symfony@95bb8bb · GitHub
[go: up one dir, main page]

Skip to content

Commit 95bb8bb

Browse files
bug #18814 Fixed server status command when port has been omitted (peterrehm)
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes #18814). Discussion ---------- Fixed server status command when port has been omitted | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18810 | License | MIT | Doc PR | - Modified the status command to behave exactly as the server:start command. When the port is omitted in the address argument the default port is added from the port option. Commits ------- 94e4706 Fixed server status command when port has been omitted
2 parents 4f7c6ce + 94e4706 commit 95bb8bb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Console\Input\InputArgument;
1515
use Symfony\Component\Console\Input\InputInterface;
16+
use Symfony\Component\Console\Input\InputOption;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718

1819
/**
@@ -31,6 +32,7 @@ protected function configure()
3132
$this
3233
->setDefinition(array(
3334
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'),
35+
new InputOption('port', 'p', InputOption::VALUE_REQUIRED, 'Address port number', '8000'),
3436
))
3537
->setName('server:status')
3638
->setDescription('Outputs the status of the built-in web server for the given address')
@@ -44,6 +46,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
4446
{
4547
$address = $input->getArgument('address');
4648

49+
if (false === strpos($address, ':')) {
50+
$address = $address.':'.$input->getOption('port');
51+
}
52+
4753
// remove an orphaned lock file
4854
if (file_exists($this->getLockFile($address)) && !$this->isServerRunning($address)) {
4955
unlink($this->getLockFile($address));

0 commit comments

Comments
 (0)
0