Fixed server status command when port has been omitted
This commit is contained in:
parent
4f7c6ceb60
commit
94e4706609
@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command;
|
|||||||
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,6 +32,7 @@ class ServerStatusCommand extends ServerCommand
|
|||||||
$this
|
$this
|
||||||
->setDefinition(array(
|
->setDefinition(array(
|
||||||
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'),
|
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'),
|
||||||
|
new InputOption('port', 'p', InputOption::VALUE_REQUIRED, 'Address port number', '8000'),
|
||||||
))
|
))
|
||||||
->setName('server:status')
|
->setName('server:status')
|
||||||
->setDescription('Outputs the status of the built-in web server for the given address')
|
->setDescription('Outputs the status of the built-in web server for the given address')
|
||||||
@ -44,6 +46,10 @@ class ServerStatusCommand extends ServerCommand
|
|||||||
{
|
{
|
||||||
$address = $input->getArgument('address');
|
$address = $input->getArgument('address');
|
||||||
|
|
||||||
|
if (false === strpos($address, ':')) {
|
||||||
|
$address = $address.':'.$input->getOption('port');
|
||||||
|
}
|
||||||
|
|
||||||
// remove an orphaned lock file
|
// remove an orphaned lock file
|
||||||
if (file_exists($this->getLockFile($address)) && !$this->isServerRunning($address)) {
|
if (file_exists($this->getLockFile($address)) && !$this->isServerRunning($address)) {
|
||||||
unlink($this->getLockFile($address));
|
unlink($this->getLockFile($address));
|
||||||
|
Reference in New Issue
Block a user