Check version of PowerShell in build script #2235
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
If you run the current
build.ps1
script with PowerShell 2 or earlier, the$PSScriptRoot
variable isn't set, which means several of the build script's variables are set to either the empty string or incomplete values. This has many consequences, for example the_build
directory is created in the root of the drive.CKAN/build.ps1
Lines 12 to 18 in 700f709
Changes
This pull request checks the currently running version of PowerShell and prints an error if it's less than 3.0:
We could try to make the script backwards compatible with PowerShell 2.0, but PowerShell is up to 5.1 now, so it's probably better just to upgrade.
I wanted to use
Write-Error
, but apparently there's no way to turn off its (in this case useless) stack trace output.