edit-in-kitty: Warn if SSH connection has dropped when attempting to update remote file
This commit is contained in:
parent
9aab18d724
commit
60e2d61eb4
1 changed files with 9 additions and 2 deletions
|
|
@ -962,8 +962,9 @@ def __init__(self, msg: str) -> None:
|
|||
|
||||
def __del__(self) -> None:
|
||||
if self.tdir:
|
||||
with suppress(OSError):
|
||||
shutil.rmtree(self.tdir)
|
||||
if not self.abort_signaled == 'disconnected':
|
||||
with suppress(OSError):
|
||||
shutil.rmtree(self.tdir)
|
||||
self.tdir = ''
|
||||
|
||||
def read_data(self) -> bytes:
|
||||
|
|
@ -1002,6 +1003,12 @@ def check_status(self, timer_id: int | None = None) -> None:
|
|||
self.schedule_check()
|
||||
|
||||
def send_data(self, window: Window, data_type: str, data: bytes = b'') -> None:
|
||||
if not self.is_local_file and not window.child_is_remote:
|
||||
self.abort_signaled = 'disconnected'
|
||||
get_boss().show_error(
|
||||
'edit-in-kitty', f'Failed to sync file due to the SSH connection dropping. Your local changes can still be found at {self.file_localpath}'
|
||||
)
|
||||
return
|
||||
window.write_to_child(f'KITTY_DATA_START\n{data_type}\n')
|
||||
if data:
|
||||
import base64
|
||||
|
|
|
|||
Loading…
Reference in a new issue