Created
November 11, 2024 02:43
-
-
Save bsdayo/e66e39e8a2171269b145074f74539bab to your computer and use it in GitHub Desktop.
Capture both stdout and stderr to separate variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$err = ($out = somecommand) 2>&1 | |
# Type of $out is string[] if present | |
# Type of $err is ErrorRecord if present |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment