Copilot commented on code in PR #2860:
URL: https://github.com/apache/tika/pull/2860#discussion_r3334465195


##########
docs/publish-docs.sh:
##########
@@ -61,6 +61,22 @@ if [[ ! -d target/site ]]; then
     exit 1
 fi
 
+# Run sed and replace $output atomically. The plain 'sed IN > OUT' form
+# truncates OUT before sed runs, so a missing input or sed failure leaves an
+# empty file behind; this writes to OUT.tmp first and only renames on success.
+# Important for PUBLISH_DIR/search-index.js, which persists across runs (a
+# corrupted one would stay corrupted until the next successful publish).
+sed_atomic() {
+    local script="$1" input="$2" output="$3"
+    if [[ ! -f "${input}" ]]; then
+        echo "${input} not found." >&2
+        echo "Re-run 'mvn package -pl docs' to regenerate it." >&2
+        exit 1

Review Comment:
   The regeneration hint in this new error message suggests running `mvn 
package -pl docs`, but this script runs from `docs/` (and earlier in the script 
the build hint uses `cd .. && ./mvnw package -pl docs`). Using `mvn` directly 
may fail for contributors relying on the Maven wrapper and/or from the `docs/` 
directory; please align this message with the documented/earlier command.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to