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) 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'''