From 8504c348bd36ff324f091bbc9182d55d2a78a0eb Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 5 Nov 2020 11:33:50 -0700 Subject: [PATCH 1/2] Raise SystemExit when port-forwarding is enabled --- jupyter_forward/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter_forward/core.py b/jupyter_forward/core.py index dc02ef2..41f987f 100644 --- a/jupyter_forward/core.py +++ b/jupyter_forward/core.py @@ -35,7 +35,7 @@ class RemoteRunner: shell: str = '/usr/bin/env bash' def __post_init__(self): - if not is_port_available(self.port): + if self.port_forwarding and not is_port_available(self.port): raise SystemExit( ( f'''Specified port={self.port} is already in use on your local machine. Try a different port''' From 13c6bc43f74ac6a8844f46a8be97e5209ab07ea4 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 5 Nov 2020 11:37:31 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c6e10b..75313a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- 🐛 Raise SystemExit when port-forwarding is enabled and local port is not available. PR [#48](https://github.com/NCAR/jupyter-forward/pull/48) by [@andersy005](https://github.com/andersy005) + ## v2020.10.27 - ⚡ Use try block to exit gracefully. PR [#45](https://github.com/NCAR/jupyter-forward/pull/45) by [@andersy005](https://github.com/andersy005)