Skip to content

Commit 4e939a0

Browse files
committed
Don't use -Raw to preserve backward compat
1 parent f4e161a commit 4e939a0

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

Build.ps1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ param(
3232
$Script:TraceVerboseTimer = New-Object System.Diagnostics.Stopwatch
3333
$Script:TraceVerboseTimer.Start()
3434

35-
3635
$ErrorActionPreference = "Stop"
3736
Set-StrictMode -Version Latest
3837

@@ -241,13 +240,19 @@ function build {
241240
}
242241
$null = mkdir $ReleasePath -Force
243242
$ReleaseModule = Join-Path $ReleasePath ${RootModule}
244-
Trace-Message " Setting content for $ReleaseModule"
245-
246243
$FunctionsToExport = Join-Path $SourcePath Public\*.ps1 -Resolve | % { [System.IO.Path]::GetFileNameWithoutExtension($_) }
247-
Set-Content $ReleaseModule ((
248-
(Get-Content (Join-Path $SourcePath Private\*.ps1) -Raw) +
249-
(Get-Content (Join-Path $SourcePath Public\*.ps1) -Raw)) -join "`r`n`r`n`r`n") -Encoding UTF8
250244

245+
Trace-Message " Setting content for $ReleaseModule"
246+
try {
247+
Set-Content $ReleaseModule (
248+
@(
249+
@(Get-Content $(Join-Path $SourcePath Private\*.ps1) -Raw) +
250+
@(Get-Content $(Join-Path $SourcePath Public\*.ps1) -Raw)
251+
) -join "`r`n`r`n`r`n") -Encoding UTF8
252+
} catch {
253+
Trace-Message " FAILED AT: $($_.InvocationInfo.PositionMessage)"
254+
Write-Error $_ -ErrorAction Stop
255+
}
251256
# If there are any folders that aren't Public, Private, Tests, or Specs ...
252257
$OtherFolders = Get-ChildItem $SourcePath -Directory -Exclude Public, Private, Tests, Specs
253258
# Then we need to copy everything in them
@@ -476,11 +481,9 @@ function Trace-Message {
476481

477482
# First call to Trace-Message, pass in our TraceTimer to make sure we time EVERYTHING.
478483
Trace-Message "BUILDING: $ModuleName in $Path" -Stopwatch $TraceVerboseTimer
479-
480484
Push-Location $Path
481485

482-
init
483-
486+
init # always runs
484487
foreach($s in $step){
485488
Trace-Message "Invoking Step: $s"
486489
&$s

Tests/Status.Steps.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ Then 'the content of ["''](?<file>.*)["''] should be ["''](?<content>.*)["'']' {
445445

446446
if(Test-Path $file -PathType Leaf)
447447
{
448-
$data = Get-Content $file -Raw
448+
$data = Get-Content $file -Delimiter ([char]0)
449449
if($data -eq $content -or $data.Trim() -eq $content)
450450
{
451451
return $true

0 commit comments

Comments
 (0)