# What to do when Julia runs away from you? (how to interrupt on C-c?)

**URL:** <https://discourse.julialang.org/t/what-to-do-when-julia-runs-away-from-you-how-to-interrupt-on-c-c/85310>\
**Category:** General Usage\
**Created:** [August 4, 2022, 5:41pm UTC](https://discourse.julialang.org/t/what-to-do-when-julia-runs-away-from-you-how-to-interrupt-on-c-c/85310 "2022-08-04T17:41:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brad\_Carman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brad_carman/32/17631_2.png) [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Post date:** [August 4, 2022, 5:41pm UTC](https://discourse.julialang.org/t/what-to-do-when-julia-runs-away-from-you-how-to-interrupt-on-c-c/85310/1 "2022-08-04T17:41:11Z")

</div>

I’m currently working on a model that somehow get’s in a solving loop that I can’t cancel with `Ctrl+C`. To prove this I’m printing to the console from within the `while` loop that is running away. I can see the print statement reporting the ever increasing index to the console, but my keyboard input of `Ctrl+C` is ignored. Is there another way to interrupt Julia? My only solution at the moment is to kill Julia, but this is not ideal since I need to spend minutes re-compiling the current project.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [August 4, 2022, 6:18pm UTC](https://discourse.julialang.org/t/what-to-do-when-julia-runs-away-from-you-how-to-interrupt-on-c-c/85310/2 "2022-08-04T18:18:43Z")

</div>

I’m not really answering your question, but maybe providing a useful workaround. I find myself frequently in such situations when adding debugging `prints` to the code. What I do now to avoid having to kill julia, is to add `readline()` after the debugging print. `Control-C` after a `readline()` usually works without major issues.

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [August 4, 2022, 6:26pm UTC](https://discourse.julialang.org/t/what-to-do-when-julia-runs-away-from-you-how-to-interrupt-on-c-c/85310/3 "2022-08-04T18:26:19Z")

</div>

I remember reding that julia only catches the Control-c on yieldpoints. Because I don’t know enough about this it may fail, but. If you add `yield()` inside the while. Are you able to interrupt via Control-C?
