diff --git a/demos/demo_operation_log.sh b/demos/demo_operation_log.sh index 7205f293eb..a0918fac7c 100755 --- a/demos/demo_operation_log.sh +++ b/demos/demo_operation_log.sh @@ -27,7 +27,7 @@ comment "The repo now looks like this:" run_command "jj log" comment "The most recent portion of the operation log is:" -run_command "jj op log | head" +run_command_allow_broken_pipe "jj op log | head" comment "Let's undo that rebase operation:" rebase_op=$(jj debug operation --display id --at-op @-- | head --bytes 8) diff --git a/demos/helpers.sh b/demos/helpers.sh index 8a3832aa6e..a83b02033d 100644 --- a/demos/helpers.sh +++ b/demos/helpers.sh @@ -14,6 +14,21 @@ run_command() { eval "$@" } +run_command_allow_broken_pipe() { + run_command "$@" || { + EXITCODE="$?" + case $EXITCODE in + 3) + # `jj` exits with error coded 3 on broken pipe, + # which can happen simply because of running + # `jj|head`. + return 0;; + *) + return $EXITCODE;; + esac + } +} + blank() { echo "" }