Errors output by StaticExportPathCommand don't get shown because the overall command returns success

Created on 31 January 2024, 10 months ago
Updated 19 September 2024, 2 months ago

Problem/Motivation

StaticExportPathCommand gets called repeatedly by StaticCommand during a static export.

StaticExportPathCommand does this if it encounters an error when requesting a single path (and ideally, that should include a request returning a 500 error -- see StaticGenerator::requestPath() doesn't do anything with a request that produces a 500 error Needs review ) --

      try {
        $invoke_paths = array_merge($this->static->requestPath($path), $invoke_paths);
      }
      catch (\Exception $e) {
        $this->io->getErrorStyle()->error($this->formatPathException($path, $e));
      }

But it then keeps going, and so returns the command as completing successfully.

But ProcessTrait::runCommands() checks for process failure when deciding whether to get errors from it:

      if (!$is_running) {
        if (!$process->isSuccessful()) {
          $error_output = $process->getErrorOutput();
          $collected_errors[] = "Error when running \"{$command}\":\n  $error_output";
        }

That means that the error from StaticExportPathCommand can never be seen when it's being executed as a subprocess by StaticCommand.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

RTBC

Version

1.0

Component

Tome Static

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024