From bf7c6d3ad4b06a5840d6b0a91eef01765b7c1e7f Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Sat, 9 Sep 2023 22:34:41 -0700 Subject: [PATCH] demos: extract some of `run_scripts.sh` to a function This allows `run_scripts.sh | pager` to work. --- demos/run_scripts.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/demos/run_scripts.sh b/demos/run_scripts.sh index bab4ea7c74..9b264411cf 100755 --- a/demos/run_scripts.sh +++ b/demos/run_scripts.sh @@ -31,7 +31,8 @@ GIT_CONFIG_GLOBAL=$(mktemp --tmpdir gitconfig-XXXX) export GIT_CONFIG_GLOBAL git_config "$GIT_CONFIG_GLOBAL" -for script in "$@"; do +run_script_through_term_transcript_and_pipe_result_to_stderr() { + script="$1" script_base="${script%.sh}" script_base="${script_base#demo_}" # We use `term-transcript capture` instead of `term-transcript exec` so that @@ -39,6 +40,10 @@ for script in "$@"; do (bash "$script" || (echo "SCRIPT FAILED WITH EXIT CODE $?"; false)) 2>&1 | \ tee /dev/stderr | \ term-transcript capture --no-inputs --pure-svg --out "$script_base".svg "$script_base" +} + +for script in "$@"; do + run_script_through_term_transcript_and_pipe_result_to_stderr "$script" 2>&1 # Resize to 700 width and any height which convert > /dev/null \ && convert -resize 700x10000 -colors 50 -background black \