From c531098f3be5c6f5e671a162e6c49751474609f6 Mon Sep 17 00:00:00 2001 From: coderdad Date: Wed, 31 Aug 2016 22:42:27 -0400 Subject: [PATCH] Working directory fix for googletest submodule update (#2151) * Working directory fix for submodule update The git submodule update for googletest must be run from the script's root directory * Added try-finally block around Push-Location Great recommendation from @vors! The edit is a best practice incase the user Ctrl-C's out of the script. Tested locally by exiting out of: try { Push-Location C:\Users\; Start-Sleep -Seconds 60 } finally { Pop-Location } --- build.psm1 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build.psm1 b/build.psm1 index c4f847333..bb3443d3b 100644 --- a/build.psm1 +++ b/build.psm1 @@ -698,9 +698,14 @@ function Start-PSBootstrap { try { # Update googletest submodule for linux native cmake if ($IsLinux -or $IsOSX) { - $Submodule = "$PSScriptRoot/src/libpsl-native/test/googletest" - Remove-Item -Path $Submodule -Recurse -Force -ErrorAction SilentlyContinue - git submodule update --init -- $submodule + try { + Push-Location $PSScriptRoot + $Submodule = "$PSScriptRoot/src/libpsl-native/test/googletest" + Remove-Item -Path $Submodule -Recurse -Force -ErrorAction SilentlyContinue + git submodule update --init -- $submodule + } finally { + Pop-Location + } } # Install ours and .NET's dependencies