Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #2083 from cchurch/win_lineinfile_fixes
Browse files Browse the repository at this point in the history
Fix win_lineinfile to pass integration tests
  • Loading branch information
cchurch committed Oct 14, 2015
2 parents 4c722dd + 0e3f7c9 commit 84b1a1a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions windows/win_lineinfile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,11 @@ Elseif (Test-Path $dest) {
$found = $FALSE;
Foreach ($encoding in $sortedlist.GetValueList()) {
$preamble = $encoding.GetPreamble();
If ($preamble) {
Foreach ($i in 0..$preamble.Length) {
If ($preamble -and $bom) {
Foreach ($i in 0..($preamble.Length - 1)) {
If ($i -ge $bom.Length) {
break;
}
If ($preamble[$i] -ne $bom[$i]) {
break;
}
Expand Down Expand Up @@ -427,7 +430,7 @@ If ($state -eq "present") {
}
Else {

If ($regex -eq $FALSE -and $line -eq $FALSE) {
If ($regexp -eq $FALSE -and $line -eq $FALSE) {
Fail-Json (New-Object psobject) "one of line= or regexp= is required with state=absent";
}

Expand Down

0 comments on commit 84b1a1a

Please sign in to comment.