Closed levpaul closed 9 years ago
Thanks @levilovelock, a bug was just raised (#34) which addresses the exit codes - this has been somewhat known for a while - good to be properly captured.
WRT the wait, it's likely to do with the fact we are running this process via another powershell process (https://github.com/packer-community/packer-windows-plugins/blob/master/provisioner/powershell/provisioner.go#L118).
If you could please submit a gist containing an example packer setup we can then work on making that pass.
Appreciate the help.
FYI - the exit code problem should now be sorted (you can grab the latest binary from here: https://github.com/packer-community/packer-windows-plugins/releases/tag/v1.0.0-rc).
I'm not sure about the sleep, i'll have to have a bit more of a play to fully grasp the situation. I think the solution might be to wrap up the async command as you have done, however.
Ah, thanks for the update! I actually managed to fix the problem by upgrading my powershell from 3.0 -> 4.0 ... -Wait seems to work fine now. Thanks again for your fast responses :)
No worries - out of interest, was that on your host machine or the guest? Might be a good tip to put in our docu that is in need of some love.
It was on the guest (amazon windows 2008r2 base image)
Thanks @levilovelock, noted. Closing this one for now.
If I have a script like:
And run it under the powershell provisioner, I see two errors. Firstly, the wait is not respected and also the return code is 0, so it passes.
I get each of those behaviour when I invoke the command through the winrm binary from the package that you're using for the communicator, so I will raise an issue there too. Not sure if you guys know if there's something I can add here to make it behave as I want?
I should note that this works for blocking the script:
Still can't work around the exit status though!