packer-community / winrmcp

Copy files to a remote host using WinRM
MIT License
59 stars 31 forks source link

removed unnecessary code. #30

Closed diegogoding closed 6 years ago

diegogoding commented 6 years ago

Removed unnecessary code for a Windows 2016 PowerShell error work around. (PR 29)

I was not liking that extra check path, because the check path was unnecessary. I was looking for a simpler way. I found one, It still doesn't explain much to me. It just seems like powershell is being a pain.

This is the error message I get after editing to the script to log the error message: errored: unexpected EOF. This is the bit of code solves the problem, by essentially creating an anonymous function with PS Script Block notation: &{Remove-Item %s -ErrorAction SilentlyContinue} And no longer throws unexpected EOF errors.

diegogoding commented 6 years ago

Checking to make sure the file exists before trying to delete that file is probably a better practice than simply quieting an error message.