8000 Fixed server status command when port has been omitted · symfony/symfony@94e4706 · GitHub
[go: up one dir, main page]

Skip to content

Commit 94e4706

Browse files
peterrehmnicolas-grekas
authored andcommitted
Fixed server status command when port has been omitted
1 parent 4f7c6ce commit 94e4706

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