Skip to content

Commit

Permalink
Merge branch 'main' into mdupuy/-/migrate-to-pyproject-toml
Browse files Browse the repository at this point in the history
  • Loading branch information
deronnax authored Dec 3, 2024
2 parents 94c0911 + 9b6925e commit 67beaea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Contributors:
* saucoide
* Chris Rose (offbyone/offby1)
* Mathieu Dupuy (deronnax)
* Chris Novakovic

Creator:
--------
Expand Down
4 changes: 4 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Features
* Add a `--ping` command line option; allows pgcli to replace `pg_isready`
* Changed the packaging metadata from setup.py to pyproject.toml

Bug fixes:
----------
* Avoid raising `NameError` when exiting unsuccessfully in some cases

4.1.0 (2024-03-09)
==================

Expand Down
14 changes: 7 additions & 7 deletions pgcli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ def connect_service(self, service, user):
click.secho(
f"service '{service}' was not found in {file}", err=True, fg="red"
)
exit(1)
sys.exit(1)
self.connect(
database=service_config.get("dbname"),
host=service_config.get("host"),
Expand Down Expand Up @@ -710,7 +710,7 @@ def should_ask_for_password(exc):
self.logger.handlers = logger_handlers
self.logger.error("traceback: %r", traceback.format_exc())
click.secho(str(e), err=True, fg="red")
exit(1)
sys.exit(1)
self.logger.handlers = logger_handlers

atexit.register(self.ssh_tunnel.stop)
Expand Down Expand Up @@ -763,7 +763,7 @@ def should_ask_for_password(exc):
self.logger.debug("Database connection failed: %r.", e)
self.logger.error("traceback: %r", traceback.format_exc())
click.secho(str(e), err=True, fg="red")
exit(1)
sys.exit(1)

self.pgexecute = pgexecute

Expand Down Expand Up @@ -1551,7 +1551,7 @@ def cli(
err=True,
fg="red",
)
exit(1)
sys.exit(1)

if ssh_tunnel and not SSH_TUNNEL_SUPPORT:
click.secho(
Expand All @@ -1560,7 +1560,7 @@ def cli(
err=True,
fg="red",
)
exit(1)
sys.exit(1)

pgcli = PGCli(
prompt_passwd,
Expand Down Expand Up @@ -1604,15 +1604,15 @@ def cli(
err=True,
fg="red",
)
exit(1)
sys.exit(1)
except Exception:
click.secho(
"Invalid DSNs found in the config file. "
'Please check the "[alias_dsn]" section in pgclirc.',
err=True,
fg="red",
)
exit(1)
sys.exit(1)
pgcli.connect_uri(dsn_config)
pgcli.dsn_alias = dsn
elif "://" in database:
Expand Down

0 comments on commit 67beaea

Please sign in to comment.