# Pass Ctrl+C signal from ctest to test programs.

**URL:** https://discourse.cmake.org/t/pass-ctrl-c-signal-from-ctest-to-test-programs/10794
**Category:** Usage
**Created:** [May 3, 2024, 9:28am UTC](https://discourse.cmake.org/t/pass-ctrl-c-signal-from-ctest-to-test-programs/10794 "2024-05-03T09:28:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mokoko](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mokoko/32/4557_2.png) [@mokoko](https://discourse.cmake.org/u/mokoko)
#### Post date: [May 3, 2024, 9:28am UTC](https://discourse.cmake.org/t/pass-ctrl-c-signal-from-ctest-to-test-programs/10794/1 "2024-05-03T09:28:10Z")

</div>

My situation is exactly like [https://cmake.org/pipermail/cmake/2014-August/058437.html](https://cmake.org/pipermail/cmake/2014-August/058437.html).

I want to run some clean up when signals like SIGTERM are received. When I run the test manually and press Ctrl+C, the signal is handled correctly and cleans up as expected. With ctest, this is not the case and it seems ctest is not sending the signals to the test program.

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [May 3, 2024, 5:03pm UTC](https://discourse.cmake.org/t/pass-ctrl-c-signal-from-ctest-to-test-programs/10794/2 "2024-05-03T17:03:23Z")

</div>

Although this is not exactly what you want, I wonder if the signaling enabled recently could be further adapted to your needs.  
[https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/8472/diffs](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8472/diffs)

---

<div class="post-metadata">

### Author: ![mokoko](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mokoko/32/4557_2.png) [@mokoko](https://discourse.cmake.org/u/mokoko)
#### Post date: [May 4, 2024, 10:10am UTC](https://discourse.cmake.org/t/pass-ctrl-c-signal-from-ctest-to-test-programs/10794/3 "2024-05-04T10:10:12Z")

</div>

Thank you!

Yeah it’s close, but it can only be used when the test program times out, so not sure it can be applied in my case, since this one involves catching signals sent to ctest.

Also, looks like it’s something that has bothered a couple of people before now:

- [https://cmake.org/pipermail/cmake-developers/2014-June/010705.html](https://cmake.org/pipermail/cmake-developers/2014-June/010705.html)
- [https://cmake.org/pipermail/cmake/2006-November/011840.html](https://cmake.org/pipermail/cmake/2006-November/011840.html)
