diff --git a/src/rezplugins/shell/_utils/powershell_base.py b/src/rezplugins/shell/_utils/powershell_base.py index f059bb248..bf9d3014d 100644 --- a/src/rezplugins/shell/_utils/powershell_base.py +++ b/src/rezplugins/shell/_utils/powershell_base.py @@ -174,7 +174,7 @@ def _record_shell(ex, files, bind_rez=True, print_msg=False): # only the bool $? var is set. # executor.command( - "if(! $?) {\n" + "if(! $? -or $LASTEXITCODE) {\n" " if ($LASTEXITCODE) {\n" " exit $LASTEXITCODE\n" " }\n"