Results for “exit”
Small, practical examples. Search by task or narrow things down below.
Detect an error inside a pipeline
Use pipefail to observe failure before the last pipeline command.
pipefail✓ Tested
Handle an expected child-process failure
Python: Catch CalledProcessError when check=True reports a nonzero exit status.
Python✓ Tested
Reject a missing required configuration value
Bash Scripts: Check a required value explicitly and emit a controlled diagnostic before exiting.
Bash Scripts✓ Tested
Retrieve a file from a stopped container
Docker / Compose: The writable layer remains available for docker cp after exit.
Docker / Compose✓ Tested
Return text from a shell function
Capture a function’s output with command substitution.
function✓ Tested
Run a one-off container
Run a command and remove its stopped container automatically.
run✓ Tested
Run cleanup through a scoped destructor
C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.
C++✓ Tested
Run with a read-only root filesystem
Add a temporary writable location while protecting the image filesystem.
read-only✓ Tested
Stop a child process created by the script
Bash Scripts: Send a signal only to the captured PID of the script’s own child and wait for it to exit.
Bash Scripts✓ Tested
Stop a search loop at the first match
Bash Scripts: Break exits the current loop as soon as the desired item is found.
Bash Scripts✓ Tested
Test whether one revision is an ancestor of another
Git: merge-base --is-ancestor reports its answer through the exit status.
Git✓ Tested