Skip to content

Commit

Permalink
Update Serve.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Jan 12, 2024
1 parent 52b9212 commit 2d92dd6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Command/Serve.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
$buildProcess->setPty(Process::isPtySupported());
$buildProcess->setTimeout(3600 * 2); // timeout = 2 minutes

$processOutputCallback = function ($type, $data) use ($output) {
$output->write($data, false, OutputInterface::OUTPUT_RAW);
$processOutputCallback = function ($type, $buffer) use ($output) {
$output->write($buffer, false, OutputInterface::OUTPUT_RAW);
};

// (re)builds before serve
if ($this->getBuilder()->isDebug()) {
$output->writeln(sprintf('<comment>Build process: %s</comment>', implode(' ', $buildProcessArguments)));
}
$output->writeln(sprintf('<comment>Build process: %s</comment>', implode(' ', $buildProcessArguments)), OutputInterface::VERBOSITY_DEBUG);
$buildProcess->run($processOutputCallback);
if ($buildProcess->isSuccessful()) {
Util\File::getFS()->dumpFile(Util::joinFile($this->getPath(), self::TMP_DIR, 'changes.flag'), time());
Expand Down Expand Up @@ -177,7 +175,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$output->writeln(sprintf('<comment>Server process: %s</comment>', $command), OutputInterface::VERBOSITY_DEBUG);
$output->writeln(sprintf('Starting server (<href=http://%s:%d>%s:%d</>)...', $host, $port, $host, $port));
$process->start(function ($type, $buffer) use (&$output) {
$process->start(function ($type, $buffer) {
if ($type === Process::ERR) {
error_log($buffer, 3, Util::joinFile($this->getPath(), self::TMP_DIR, 'errors.log'));
}
Expand Down

0 comments on commit 2d92dd6

Please sign in to comment.