From e419d4aad6e5f8403dccef69b68d77d1772fa2f3 Mon Sep 17 00:00:00 2001 From: Jonathan Gilbert Date: Thu, 20 Nov 2025 10:21:11 -0600 Subject: [PATCH 1/2] Updated Start-NativeExecution to capture the current directory before executing the script block and then include it in the error message if one happens. --- tools/buildCommon/startNativeExecution.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/buildCommon/startNativeExecution.ps1 b/tools/buildCommon/startNativeExecution.ps1 index ee7b00d04cd..37c998b1e92 100644 --- a/tools/buildCommon/startNativeExecution.ps1 +++ b/tools/buildCommon/startNativeExecution.ps1 @@ -16,6 +16,8 @@ function script:Start-NativeExecution { $ErrorActionPreference = "Continue" Write-Verbose "Executing: $ScriptBlock" try { + $cwd = Get-Location + if ($VerboseOutputOnError.IsPresent) { $output = & $ScriptBlock 2>&1 } else { @@ -36,10 +38,10 @@ function script:Start-NativeExecution { $callerFile = $callerLocationParts[0] $callerLine = $callerLocationParts[1] - $errorMessage = "Execution of {$ScriptBlock} by ${callerFile}: line $callerLine failed with exit code $LASTEXITCODE" + $errorMessage = "Execution of {$ScriptBlock} in '$cwd' by ${callerFile}: line $callerLine failed with exit code $LASTEXITCODE" throw $errorMessage } - throw "Execution of {$ScriptBlock} failed with exit code $LASTEXITCODE" + throw "Execution of {$ScriptBlock} in '$cwd' failed with exit code $LASTEXITCODE" } } finally { $ErrorActionPreference = $backupEAP From 6daf5c6e7267d2185da80b105da8bfd31e38f230 Mon Sep 17 00:00:00 2001 From: Jonathan Gilbert Date: Fri, 21 Nov 2025 17:43:35 -0600 Subject: [PATCH 2/2] Fix indentation. --- tools/buildCommon/startNativeExecution.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/buildCommon/startNativeExecution.ps1 b/tools/buildCommon/startNativeExecution.ps1 index 37c998b1e92..2e44d86bd6a 100644 --- a/tools/buildCommon/startNativeExecution.ps1 +++ b/tools/buildCommon/startNativeExecution.ps1 @@ -16,7 +16,7 @@ function script:Start-NativeExecution { $ErrorActionPreference = "Continue" Write-Verbose "Executing: $ScriptBlock" try { - $cwd = Get-Location + $cwd = Get-Location if ($VerboseOutputOnError.IsPresent) { $output = & $ScriptBlock 2>&1