diff options
author | Tom Lane | 2021-11-19 17:11:38 +0000 |
---|---|---|
committer | Tom Lane | 2021-11-19 17:11:46 +0000 |
commit | 46d665bc26ce57b5afecbc218c8fc3c6848211d8 (patch) | |
tree | 9e18d7de6e6728fec226b1004bb96578b4d03636 /src/common/sprompt.c | |
parent | 3b34645678d1a516c148e3e27c26325708e92f6f (diff) |
Allow psql's other uses of simple_prompt() to be interrupted by ^C.
This fills in the work left un-done by 5f1148224. \prompt can
be canceled out of now, and so can password prompts issued during
\connect. (We don't need to do anything for password prompts
issued during startup, because we aren't yet trapping SIGINT
at that point.)
Nathan Bossart
Discussion: https://postgr.es/m/747443.1635536754@sss.pgh.pa.us
Diffstat (limited to 'src/common/sprompt.c')
-rw-r--r-- | src/common/sprompt.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/sprompt.c b/src/common/sprompt.c index 917676b58ce..8f5aeeccbc0 100644 --- a/src/common/sprompt.c +++ b/src/common/sprompt.c @@ -164,6 +164,12 @@ simple_prompt_extended(const char *prompt, bool echo, fflush(termout); #endif } + else if (prompt_ctx && prompt_ctx->canceled) + { + /* also echo \n if prompt was canceled */ + fputs("\n", termout); + fflush(termout); + } if (termin != stdin) { |