Discussion:
[vagrant-up] Custom cleanup on Ctrl-C interruption of vagrant provision
Rob Ots
2018-11-15 18:53:50 UTC
Permalink
I have a provisioning step that does a Powershell Start-Process. If the
vagrant provision is interrupted with Ctrl-C, that leaves the process
continuing on the guest VM. Is there possibly a way to specify a custom
cleanup step that would get called if provisioning is Ctrl-C interrupted
(to ensure those processes are killed)?
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/bb0992c6-7e89-4a1d-90fc-a0fe1d3f7062%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Rob Ots
2018-11-15 19:04:59 UTC
Permalink
More information: I had tried using a try-finally mechanism in the
provisioning Powershell script. That does seem to call the finally block on
Ctrl-C interrupting the vagrant provision if the guest VM has Powershell 2,
but does not seem to when the guest VM has Powershell 5. Is there possibly
an equivalent try-finally mechanism available at the vagrant provision
level?
Post by Rob Ots
I have a provisioning step that does a Powershell Start-Process. If the
vagrant provision is interrupted with Ctrl-C, that leaves the process
continuing on the guest VM. Is there possibly a way to specify a custom
cleanup step that would get called if provisioning is Ctrl-C interrupted
(to ensure those processes are killed)?
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/25d0eb0e-286b-4aaa-b2a5-fea5374de75f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alvaro Miranda Aguilera
2018-11-15 20:32:17 UTC
Permalink
without vagrant

if you run and cancel a powershell script what happens?

whats the vagrantfile code you are usin to run this script?

is there a way to run a powershell in debug/trace to see what happens when
you cancel ?

in bash you can use `set -x`

thanks
alvaro
Post by Rob Ots
More information: I had tried using a try-finally mechanism in the
provisioning Powershell script. That does seem to call the finally block on
Ctrl-C interrupting the vagrant provision if the guest VM has Powershell 2,
but does not seem to when the guest VM has Powershell 5. Is there possibly
an equivalent try-finally mechanism available at the vagrant provision
level?
Post by Rob Ots
I have a provisioning step that does a Powershell Start-Process. If the
vagrant provision is interrupted with Ctrl-C, that leaves the process
continuing on the guest VM. Is there possibly a way to specify a custom
cleanup step that would get called if provisioning is Ctrl-C interrupted
(to ensure those processes are killed)?
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in
violation of those guidelines may result in your removal from this mailing
list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/25d0eb0e-286b-4aaa-b2a5-fea5374de75f%40googlegroups.com
<https://groups.google.com/d/msgid/vagrant-up/25d0eb0e-286b-4aaa-b2a5-fea5374de75f%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Alvaro
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezPisifDO3Eu9Hjq2CHKvJ-zSP7cS%2ByM3Q%2BD62fELJMAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...