psql: Replace cancel_pressed with CancelRequested

In a4fd3aa7 src/fe_utils/cancel.c was introduced which added the
CancelRequested variable. This new variable was used in psql to
replace the cancel_pressed variable, but that quickly got reverted in
5d43c3c54. The reason was that cancel_pressed had not been fully
replaced by CancelRequested everywhere in the code, and the mixed
usage caused issues (e.g. with \watch).

This now does that original refactor correctly by using
CancelRequested everywhere and completely getting rid of
cancel_pressed.

5d43c3c54 mentions the --single-step flag as something that required
further analysis. I tried --single-step with and without this commit,
and Ctrl+C behaves the same in both. I also cannot think of a reason
why it would behave any differently.

CancelRequested is set by the signal handler before psql's callback
runs, so also before any longjmp out of waiting for input. That
matches the behavior of cancel_pressed since commit 8b529705d15, so
this refactor should not cause any behavioral changes.

Author: Jelte Fennema-Nio <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5aa40dc6793a70d0cd5308dd3a5651c38d21851d

Modified Files
--------------
src/bin/psql/command.c       |  10 ++---
src/bin/psql/common.c        |  25 ++++-------
src/bin/psql/describe.c      |   9 ++--
src/bin/psql/mainloop.c      |   7 +--
src/bin/psql/variables.c     |   3 +-
src/fe_utils/print.c         | 103 ++++++++++++++++++++-----------------------
src/include/fe_utils/print.h |   4 --
7 files changed, 74 insertions(+), 87 deletions(-)

Reply via email to