# Execute some code on exit

**URL:** <https://discourse.slicer.org/t/execute-some-code-on-exit/16140>\
**Category:** Development\
**Created:** [February 22, 2021, 6:36pm UTC](https://discourse.slicer.org/t/execute-some-code-on-exit/16140 "2021-02-22T18:36:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giovform](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/giovform/32/4687_2.png) [@giovform](https://discourse.slicer.org/u/giovform)\
**Post date:** [February 22, 2021, 6:36pm UTC](https://discourse.slicer.org/t/execute-some-code-on-exit/16140/1 "2021-02-22T18:36:30Z")

</div>

Is there a way to execute some code on Slicer exit?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [February 22, 2021, 6:54pm UTC](https://discourse.slicer.org/t/execute-some-code-on-exit/16140/2 "2021-02-22T18:54:27Z")

</div>

You can detect and intercept application exit request, scene saving, shutdown, etc. at multiple levels. What exactly you would like to do and when?

---

<div class="post-metadata">

**Author:** ![giovform](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/giovform/32/4687_2.png) [@giovform](https://discourse.slicer.org/u/giovform)\
**Post date:** [February 22, 2021, 7:01pm UTC](https://discourse.slicer.org/t/execute-some-code-on-exit/16140/3 "2021-02-22T19:01:07Z")

</div>

I would like to cancel a runnig CLI at the application shutdown… I saw there is a signal emitted for startup “startupCompleted()” but none for the shutdown. Does it has to be done directly from Qt?
