Course of Raku / Objects, I/O, and exceptions / Input and output / Running external programs 🆕 / Exercises
Check the exit code
Problem
Run a command that fails on purpose — for example
sh -c 'exit 4' — and keep the Proc it returns.
Print the command’s exit code, and then print success or
failure depending on whether the command succeeded.
Example
The program prints:
4
failureSolution
Course navigation
← Solution: Capture the output | Solution: Check the exit code →