Skip to content

Commit

Permalink
Catch error when cannot resize Docker container TTY.
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Nov 7, 2024
1 parent fb06eb3 commit f3749e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 4 additions & 6 deletions gns3server/compute/base_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,11 @@ async def stop_wrap_console(self):
Stops the telnet proxy.
"""

if self._wrapper_telnet_server:
if self._wrap_console_writer:
self._wrap_console_writer.close()
if sys.version_info >= (3, 7, 0):
try:
await self._wrap_console_writer.wait_closed()
except ConnectionResetError:
pass
await self._wrap_console_writer.wait_closed()
self._wrap_console_writer = None
if self._wrapper_telnet_server:
self._wrapper_telnet_server.close()
await self._wrapper_telnet_server.wait_closed()
self._wrapper_telnet_server = None
Expand Down
5 changes: 4 additions & 1 deletion gns3server/compute/docker/docker_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,10 @@ async def _window_size_changed_callback(self, columns, rows):
"""

# resize the container TTY.
await self._manager.query("POST", "containers/{}/resize?h={}&w={}".format(self._cid, rows, columns))
try:
await self._manager.query("POST", "containers/{}/resize?h={}&w={}".format(self._cid, rows, columns))
except DockerError as e:
log.warning(f"Could not resize the container TTY: {e}")

async def _start_console(self):
"""
Expand Down

0 comments on commit f3749e8

Please sign in to comment.