Making WordPress.org

Changeset 13724


Ignore:
Timestamp:
05/17/2024 03:44:04 AM (10 months ago)
Author:
dd32
Message:

Plugin Directory: ZIP: Discard warnings from sort when piped into head.

Sort will throw STDERR data when head hangs up on it - which is intentional here, since we only want the first 10 characters of data.
The presence of error output in the log makes it appear like something may have gone wrong, when it's actually working as expected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-builder.php

    r9014 r13724  
    406406     */
    407407    protected function fix_directory_dates() {
    408         // Find all files, output their modified dates, sort reverse numerically, grab the timestamp from the first entry
     408        /*
     409         * Find all files, output their modified dates, sort reverse numerically, grab the timestamp from the first entry
     410         * Note: `sort | head` will generate STDERR output. This is expected and not a cause of concern. Silence it to remove red herrings.
     411         */
    409412        $latest_file_modified_timestamp = $this->exec( sprintf(
    410             "find %s -type f -printf '%%T@\n' | sort -nr | head -c 10",
     413            "find %s -type f -printf '%%T@\n' | sort -nr 2>/dev/null | head -c 10",
    411414            escapeshellarg( $this->tmp_build_dir )
    412415        ) );
Note: See TracChangeset for help on using the changeset viewer.