# How to exit a Julia program without completely exit REPL or shutting down Julia?

**URL:** <https://discourse.julialang.org/t/how-to-exit-a-julia-program-without-completely-exit-repl-or-shutting-down-julia/66655>\
**Category:** General Usage\
**Created:** [August 19, 2021, 5:46am UTC](https://discourse.julialang.org/t/how-to-exit-a-julia-program-without-completely-exit-repl-or-shutting-down-julia/66655 "2021-08-19T05:46:01Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [February 19, 2024, 1:12pm UTC](https://discourse.julialang.org/t/how-to-exit-a-julia-program-without-completely-exit-repl-or-shutting-down-julia/66655/22 "2024-02-19T13:12:51Z")

</div>

Just had a use case with debugging my code - I used `error("some message")` to interrupt the program execution and return to (VSCode) REPL. It does exactly what I need except it each time prints the stack which I DO NOT need.

Wouldn’t it be possible to have an additional (keyword?) argument for `error` / `throw` like `printstack=true`

---

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [October 26, 2024, 2:53pm UTC](https://discourse.julialang.org/t/how-to-exit-a-julia-program-without-completely-exit-repl-or-shutting-down-julia/66655/23 "2024-10-26T14:53:17Z")

</div>

Using the [`detach`](https://docs.julialang.org/en/v1/base/base/#Base.Cmd) keyword argument of `Cmd` seems to solve the aforementioned issue.

```julia
macro reset()
  quote
     atexit() do
         Cmd(`$(Base.julia_cmd())`; detach=true) |> run
     end
     exit()
   end
end

```

[Previous page](https://discourse.julialang.org/t/how-to-exit-a-julia-program-without-completely-exit-repl-or-shutting-down-julia/66655.md?page=1)
