You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because writes to the hosts file aren't committed until EndProcessing, piping together write operations fail. For example, the following test fails Set re-reads the hosts file and doesn't find the added entry (because it hasn't been saved yet). It would also cause undefined side effects as both cmdlets would attempt to save their copy of the hosts file.
I'm not sure the best way to resolve this problem (particularly since it's quite unlikely that someone would pipe the write operations together), but I thought it was worth documenting.
Describe "Add-HostEntry" {
Context "Piping into Set" {
BeforeEach {
Add-TestHostEntry-Name "hostname"-Loopback -HostsPath $hostsFile|`Set-TestHostEntry-Address "127.0.0.2"-HostsPath $hostsFile
}
It "Should update new entry" {
$results=Get-TestHostEntry hostname -HostsPath $hostsFile$results.Length| Should be 1
}
}
}
The text was updated successfully, but these errors were encountered:
Because writes to the hosts file aren't committed until
EndProcessing
, piping together write operations fail. For example, the following test failsSet
re-reads the hosts file and doesn't find the added entry (because it hasn't been saved yet). It would also cause undefined side effects as both cmdlets would attempt to save their copy of the hosts file.I'm not sure the best way to resolve this problem (particularly since it's quite unlikely that someone would pipe the write operations together), but I thought it was worth documenting.
The text was updated successfully, but these errors were encountered: