Skip to content

Commit 137f6ba

Browse files
authored
Updated spur to 0.3.22 and used close() method (#69)
I also put a `try` - `finally` in the `close()` method to still close sftp if there would be an error when closing the spur connection.
1 parent 80a4380 commit 137f6ba

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
license='License :: OSI Approved :: MIT License',
3535
keywords='ssh sftp spur paramiko execute remote commands modify files',
3636
packages=find_packages(exclude=['tests']),
37-
install_requires=['spur==0.3.20', 'typing_extensions>=3.6.2.1', 'icontract>=2.0.1,<3', 'temppathlib>=1.0.3,<2'],
37+
install_requires=['spur==0.3.22', 'typing_extensions>=3.6.2.1', 'icontract>=2.0.1,<3', 'temppathlib>=1.0.3,<2'],
3838
extras_require={
3939
'dev':
4040
['mypy==0.790', 'pylint==2.6.0', 'yapf==0.20.2', 'tox>=3.0.0', 'coverage>=4.5.1,<5', 'pydocstyle>=2.1.1,<3']

spurplus/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,11 +1047,12 @@ def whoami(self) -> str:
10471047

10481048
def close(self) -> None:
10491049
"""Close the underlying spur shell and SFTP (if ``close_spur_shell`` and ``close_sftp``, respectively)."""
1050-
if self.close_spur_shell:
1051-
self._spur.__exit__()
1052-
1053-
if self.close_sftp:
1054-
self._sftp.close()
1050+
try:
1051+
if self.close_spur_shell:
1052+
self._spur.close()
1053+
finally:
1054+
if self.close_sftp:
1055+
self._sftp.close()
10551056

10561057
def __enter__(self) -> 'SshShell':
10571058
"""Enter the context and give the shell prepared in the constructor."""

0 commit comments

Comments
 (0)