This is an automated email from the ASF dual-hosted git repository.
spetz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/master by this push:
new 78151b951 fix(ci): support multiline README commands (#4162)
78151b951 is described below
commit 78151b95111a7bc4427e7defa2b90260aa0e6c05
Author: Gunther Xing <[email protected]>
AuthorDate: Mon Sep 14 00:13:25 2026 +0800
fix(ci): support multiline README commands (#4162)
Closes #4161
---
examples/rust/README.md | 6 ++++--
scripts/utils.sh | 40 ++++++++++++++++++++++++++++++++++++++--
2 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/examples/rust/README.md b/examples/rust/README.md
index bbb444f1c..4cf14bbfc 100644
--- a/examples/rust/README.md
+++ b/examples/rust/README.md
@@ -96,8 +96,10 @@ Demonstrates fundamental client connection, authentication,
batch message sendin
To run the pair over HTTP:
```bash
-cargo run --example basic-producer -- --transport http
-cargo run --example basic-consumer -- --transport http
+cargo run --example basic-producer -- \
+ --transport http
+cargo run --example basic-consumer -- \
+ --transport http
```
## Message Pattern Examples
diff --git a/scripts/utils.sh b/scripts/utils.sh
index 0c7770487..cc5d4399c 100755
--- a/scripts/utils.sh
+++ b/scripts/utils.sh
@@ -343,9 +343,45 @@ function portable_timeout() {
fi
}
+# Grep must see complete shell commands instead of individual README lines.
+function read_readme_logical_lines() {
+ local readme_file="$1"
+
+ awk '
+ function has_line_continuation(line, position, count) {
+ count = 0
+ for (position = length(line); position > 0; position--) {
+ if (substr(line, position, 1) != "\\") {
+ break
+ }
+ count++
+ }
+ return count % 2 == 1
+ }
+
+ {
+ if (has_line_continuation($0)) {
+ pending = pending substr($0, 1, length($0) - 1)
+ continued = 1
+ next
+ }
+
+ print pending $0
+ pending = ""
+ continued = 0
+ }
+
+ END {
+ if (continued) {
+ print pending "\\"
+ }
+ }
+ ' "${readme_file}"
+}
+
# Run commands extracted from a README file.
# Usage: run_readme_commands readme_file grep_pattern [cmd_timeout
[grep_exclude]]
-# Reads matching lines, strips backticks/comments, executes each.
+# Reads matching logical lines, strips backticks/comments, executes each.
# Calls TRANSFORM_COMMAND function on each command if defined.
# Returns: sets global EXAMPLES_EXIT_CODE and README_COMMANDS_EXECUTED.
# Zero matches is not an error here: callers iterate multiple README
@@ -364,7 +400,7 @@ function run_readme_commands() {
fi
local commands
- commands=$(grep -E "${grep_pattern}" "${readme_file}" || true)
+ commands=$(read_readme_logical_lines "${readme_file}" | grep -E
"${grep_pattern}" || true)
if [ -n "${grep_exclude}" ]; then
commands=$(echo "${commands}" | grep -v -e "${grep_exclude}" || true)
fi