2025-01-24 16:28:15 +00:00
|
|
|
=== Capturing STDERR
|
|
|
|
>>> python3 -c import sys; sys.stderr.write("STDERR\n")
|
|
|
|
STDERR
|
|
|
|
|
|
|
|
=== Capturing STDOUT
|
|
|
|
>>> python3 -c import sys; sys.stderr.write("STDOUT\n")
|
|
|
|
STDOUT
|
|
|
|
|
|
|
|
=== Capturing exit code
|
|
|
|
>>> errcode python3 -c raise SystemExit(5)
|
|
|
|
|
|
|
|
Exit code: 5
|
|
|
|
|
|
|
|
=== Capturing exit code (alt)
|
|
|
|
>>> python3 -c raise SystemExit(7)
|
|
|
|
|
|
|
|
Exit code: 7
|
|
|
|
|
|
|
|
=== Capturing pwd
|
2025-01-24 17:31:29 +00:00
|
|
|
>>> python3 -c import os; print(os.getcwd())
|
2025-01-24 16:28:15 +00:00
|
|
|
$TMPDIR
|
|
|
|
|
|
|
|
=== Capturing subdir
|
|
|
|
>>> mkdir -p subdir/a/b/c
|
|
|
|
|
2025-01-24 17:31:29 +00:00
|
|
|
>>> withdir subdir/a/b/c python3 -c import os; print(os.getcwd())
|
2025-01-24 16:28:15 +00:00
|
|
|
$TMPDIR/subdir/a/b/c
|
|
|
|
|
|
|
|
=== Custom output files - everything starting with out is captured and compared
|
|
|
|
>>> echo HELLO
|