diff --git a/src/ServeCommand.php b/src/ServeCommand.php index d78b5f7..08308af 100644 --- a/src/ServeCommand.php +++ b/src/ServeCommand.php @@ -25,10 +25,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $port = $input->getOption('port') ? (int) $input->getOption('port') : 5500; $process = Process::fromShellCommandline("php -S localhost:$port", null, null, null, null); + // Print welcome message just once + $output->writeln("Leaf development server started: http://localhost:$port"); + $output->writeln('Happy coding!'); + return $process->run(function ($type, $line) use ($output, $port) { if (is_string($line) && !strpos($line, 'Failed')) { - $output->writeln("Leaf development server started: http://localhost:$port"); - $output->writeln('Happy coding!'); $output->write($line); } else { $output->write("$line");