You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+83Lines changed: 83 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -911,3 +911,86 @@ This repository includes a presentation about Markdown Runner.
911
911
912
912
- [View the slides](./slides/slides.md) (github will render the source somewhat)
913
913
- [Building the slides](./slides/README.md)
914
+
915
+
## Usage tips
916
+
917
+
### Limitation: interactive shell vs chunk behavior
918
+
919
+
Markdown-runner uses `set -e` to match tutorial step-by-step expectations, but this creates a disconnect between **script behavior** and **interactive shell behavior**:
920
+
921
+
**Interactive Shell** (what humans experience):
922
+
923
+
```bash
924
+
$ oikjoij || ! echo "must show up"
925
+
bash: oikjoij: command not found
926
+
must show up
927
+
$ echo $?
928
+
1 # Command failed as expected
929
+
```
930
+
931
+
**Script with `set -e`** (what markdown-runner does):
- **Humans** typing commands see failures when they expect them
942
+
- **Scripts with `set -e`** have special exemption rules for compound commands (`||`, `&&`) that mask failures
943
+
- **Tutorial authors** write commands based on interactive experience, but CI runs them as scripts
944
+
945
+
#### The `set -e` Exemption Rules
946
+
947
+
From the [Bash manual](https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/): *`"This option is also smart enough to not react on failing commands that are part of conditional statements. Moreover, you can append a command with || true for those rare cases where you don’t want a failing command to trigger an immediate exit.`"*
948
+
949
+
This means:
950
+
951
+
```bash
952
+
# Interactive shell: FAILS (exit 1)
953
+
oikjoij || ! echo "error"
954
+
955
+
# Script with set -e: SUCCEEDS (exit 0)
956
+
# Because oikjoij is "part of a || list"
957
+
```
958
+
959
+
#### The Human Expectation Gap
960
+
961
+
**Tutorial authors think:** *"I'll write this like I would in my terminal"*
0 commit comments