1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

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
This commit is contained in:
Tom Lane
2021-11-19 12:11:38 -05:00
parent 3b34645678
commit 46d665bc26
3 changed files with 43 additions and 11 deletions

View File

@@ -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)
{