Skip to content

Commit 9099e4a

Browse files
committed
psql: Set up cancel handler later
The cancel handler was uselessly set up even before the first connection was opened. By setting it up afterwards, the user can use Ctrl+C to abort psql if the initial connection attempt hangs. Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com> Reviewed-by: Ryan Kelly <rpkelly22@gmail.com>
1 parent eb5d87e commit 9099e4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin/psql/startup.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ main(int argc, char *argv[])
111111
setvbuf(stderr, NULL, _IONBF, 0);
112112
#endif
113113

114-
setup_cancel_handler();
115-
116114
pset.progname = get_progname(argv[0]);
117115

118116
pset.db = NULL;
@@ -246,6 +244,8 @@ main(int argc, char *argv[])
246244
exit(EXIT_BADCONN);
247245
}
248246

247+
setup_cancel_handler();
248+
249249
PQsetNoticeProcessor(pset.db, NoticeProcessor, NULL);
250250

251251
SyncVariables();

0 commit comments

Comments
 (0)