Stdout from drush commands stops additional HTML assets from being created

Created on 4 March 2025, about 1 month ago

Problem/Motivation

When creating the static site drush tome:static, it exports individual pages and gets their dependencies with a call to drush tome:static-export-path --return-json. If your server is configured in a way that other software is outputting logs to stdout, it could interfere with the response being valid JSON.

I ran into this with New relic, but it could happen from any thing that creates stdout during a drush call, like the log_stdout module.

Steps to reproduce

* Install and enable https://www.drupal.org/project/log_stdout β†’
* Create an event subscriber with KernelEvents::REQUEST event.
* In that event, create log something \Drupal::logger('test')->info('stuff');
* Run drush tome:static-export-path / --return-json --process-count=5`

Note how the log message is part of the response? This will cause exportPaths not to be able to parse the response as JSON and therefore no additional HTML assets will be created.

This is highly dependent on your environment, so I wouldn't say this is a bug. I just wanted to save others time if they ran into this.

Proposed resolution

Trim off any lines that are not JSON from the start of the response text.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Tome Static

Created by

πŸ‡ΊπŸ‡ΈUnited States mattsqd

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