The error described in https://github.com/hashicorp/packer/issues/6738 occurs because restoreContent() in cp.go hangs indefinitely if toPath is a directory that does not end with "\" -- for example, toPath provided as "destination": "C:\\Windows\\Temp" in the Packer config rather than "destination": "C:\\Windows\\Temp\\"
This can be solved one of two ways. Either, we can add a test to restoreContent's powershell script, which would force a failure that Packer can catch and provide direction on:
if (Test-Path -Path $dest_file_path -PathType container) {
Exit 1
}
or, we can add a test which will append "\" to a directory if it isn't already there, which would be a bit more complex. I'm happy doing either but I'd like to implement one of these options. Which do you think would be better?
The error described in https://github.com/hashicorp/packer/issues/6738 occurs because restoreContent() in cp.go hangs indefinitely if toPath is a directory that does not end with "\" -- for example, toPath provided as
"destination": "C:\\Windows\\Temp"
in the Packer config rather than"destination": "C:\\Windows\\Temp\\"
This can be solved one of two ways. Either, we can add a test to restoreContent's powershell script, which would force a failure that Packer can catch and provide direction on:
or, we can add a test which will append "\" to a directory if it isn't already there, which would be a bit more complex. I'm happy doing either but I'd like to implement one of these options. Which do you think would be better?