diff --git a/src/lib/direct.cpp b/src/lib/direct.cpp index 956519397..d2a5355cc 100644 --- a/src/lib/direct.cpp +++ b/src/lib/direct.cpp @@ -597,6 +597,9 @@ static int ncdirect_stop_minimal(void* vnc){ ncdirect* nc = static_cast(vnc); int ret = drop_signals(nc); + if(!(nc->flags & NCDIRECT_OPTION_NO_READLINE)){ + rl_deprep_terminal(); + } if(nc->tcache.op && term_emit("op", nc->tcache.op, nc->ttyfp, true)){ ret = -1; } @@ -615,9 +618,6 @@ ncdirect_stop_minimal(void* vnc){ } ret |= close(nc->ctermfd); } - if(!(nc->flags & NCDIRECT_OPTION_NO_READLINE)){ - rl_deprep_terminal(); - } return ret; }