forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5f11482
committed
Provide a variant of simple_prompt() that can be interrupted by ^C.
Up to now, you couldn't escape out of psql's \password commandby typing control-C (or other local spelling of SIGINT). Thisis pretty user-unfriendly, so improve it. To do so, we have tomodify the functions provided by pg_get_line.c; but we don'twant to mess with psql's SIGINT handler setup, so provide anAPI that lets that handler cause the cancel to occur.This relies on the assumption that we won't do any major harm bylongjmp'ing out of fgets(). While that's obviously a little shaky,we've long had the same assumption in the main input loop, and fewissues have been reported.psql has some other simple_prompt() calls that could usefullybe improved the same way; for now, just deal with \password.Nathan Bossart, minor tweaks by meDiscussion:https://postgr.es/m/747443.1635536754@sss.pgh.pa.us1 parenta148f8b commit5f11482
7 files changed
+100
-19
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
500 | 500 |
| |
501 | 501 |
| |
502 | 502 |
| |
503 |
| - | |
| 503 | + | |
504 | 504 |
| |
505 | 505 |
| |
506 | 506 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1497 | 1497 |
| |
1498 | 1498 |
| |
1499 | 1499 |
| |
1500 |
| - | |
| 1500 | + | |
1501 | 1501 |
| |
1502 | 1502 |
| |
1503 | 1503 |
| |
|
Lines changed: 21 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2025 | 2025 |
| |
2026 | 2026 |
| |
2027 | 2027 |
| |
2028 |
| - | |
2029 |
| - | |
| 2028 | + | |
| 2029 | + | |
2030 | 2030 |
| |
| 2031 | + | |
2031 | 2032 |
| |
2032 | 2033 |
| |
2033 | 2034 |
| |
| |||
2042 | 2043 |
| |
2043 | 2044 |
| |
2044 | 2045 |
| |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
2045 | 2051 |
| |
2046 | 2052 |
| |
2047 | 2053 |
| |
2048 |
| - | |
2049 |
| - | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
2050 | 2057 |
| |
2051 |
| - | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
2052 | 2064 |
| |
2053 | 2065 |
| |
2054 | 2066 |
| |
| |||
2081 | 2093 |
| |
2082 | 2094 |
| |
2083 | 2095 |
| |
2084 |
| - | |
2085 |
| - | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
2086 | 2100 |
| |
2087 | 2101 |
| |
2088 | 2102 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
|
Lines changed: 46 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| 21 | + | |
| 22 | + | |
21 | 23 |
| |
22 | 24 |
| |
23 | 25 |
| |
| |||
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
50 | 57 |
| |
51 | 58 |
| |
52 |
| - | |
| 59 | + | |
53 | 60 |
| |
54 | 61 |
| |
55 | 62 |
| |
56 | 63 |
| |
57 | 64 |
| |
58 |
| - | |
| 65 | + | |
59 | 66 |
| |
60 | 67 |
| |
61 | 68 |
| |
| |||
89 | 96 |
| |
90 | 97 |
| |
91 | 98 |
| |
92 |
| - | |
| 99 | + | |
93 | 100 |
| |
94 | 101 |
| |
95 | 102 |
| |
| |||
107 | 114 |
| |
108 | 115 |
| |
109 | 116 |
| |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
110 | 122 |
| |
111 | 123 |
| |
112 |
| - | |
| 124 | + | |
| 125 | + | |
113 | 126 |
| |
114 | 127 |
| |
115 | 128 |
| |
116 |
| - | |
117 |
| - | |
| 129 | + | |
118 | 130 |
| |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
119 | 159 |
| |
120 | 160 |
| |
121 | 161 |
| |
|
Lines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
39 | 55 |
| |
40 | 56 |
| |
41 | 57 |
| |
| |||
126 | 142 |
| |
127 | 143 |
| |
128 | 144 |
| |
129 |
| - | |
| 145 | + | |
130 | 146 |
| |
131 | 147 |
| |
132 | 148 |
| |
|
Lines changed: 13 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
15 | 23 |
| |
16 | 24 |
| |
17 | 25 |
| |
| |||
21 | 29 |
| |
22 | 30 |
| |
23 | 31 |
| |
24 |
| - | |
| 32 | + | |
25 | 33 |
| |
26 |
| - | |
| 34 | + | |
| 35 | + | |
27 | 36 |
| |
28 | 37 |
| |
29 | 38 |
| |
| 39 | + | |
| 40 | + | |
30 | 41 |
| |
31 | 42 |
|
0 commit comments
Comments
(0)