refactor(windows): ensure output redirection for Invoke-LxsSibling and Invoke-LxsScript
This commit is contained in:
@@ -745,7 +745,10 @@ function Invoke-LxsSibling {
|
||||
$local = Join-Path $SelfDirectory $name
|
||||
if (Test-Path $local) {
|
||||
$global:LASTEXITCODE = 0
|
||||
& $local @Arguments
|
||||
# Out-Host, not a bare call: anything the child writes to the success
|
||||
# stream (native command output, for one) would otherwise be collected
|
||||
# into this function's return value alongside the exit code.
|
||||
& $local @Arguments | Out-Host
|
||||
return $LASTEXITCODE
|
||||
}
|
||||
|
||||
@@ -765,7 +768,7 @@ function Invoke-LxsSibling {
|
||||
Write-LxsOk 'Payload acquired'
|
||||
try {
|
||||
$global:LASTEXITCODE = 0
|
||||
& $temp @Arguments
|
||||
& $temp @Arguments | Out-Host
|
||||
return $LASTEXITCODE
|
||||
} finally {
|
||||
Remove-Item $temp -Force -ErrorAction SilentlyContinue
|
||||
|
||||
+4
-1
@@ -224,8 +224,11 @@ function Invoke-LxsScript {
|
||||
Write-Host ''
|
||||
|
||||
$global:LASTEXITCODE = 0
|
||||
$code = 0
|
||||
try {
|
||||
& $target @Arguments
|
||||
# Out-Host keeps the child's success-stream output out of this
|
||||
# function's return value, which must be just the exit code.
|
||||
& $target @Arguments | Out-Host
|
||||
$code = $LASTEXITCODE
|
||||
} finally {
|
||||
if ($temp) { Remove-Item $temp -Force -ErrorAction SilentlyContinue }
|
||||
|
||||
Reference in New Issue
Block a user