[~] Refactort

This commit is contained in:
Siarhei Siniak 2024-11-15 20:57:06 +03:00
parent f9f18df737
commit 9620bb2b25

@ -132,8 +132,8 @@ def intercept_output(
not (isinstance(last_data, bytes) and len(last_data) == 0): not (isinstance(last_data, bytes) and len(last_data) == 0):
t3 = current_subprocess.stdout.peek() t3 = current_subprocess.stdout.peek()
t4 = current_subprocess.stdout.read(len(t3)) t4: bytes = current_subprocess.stdout.read(len(t3))
assert isinstance(t4, int) assert isinstance(t4, bytes)
last_data = t3 last_data = t3
output.append(t3) output.append(t3)
@ -1551,8 +1551,9 @@ def pass_ssh_osx(argv):
password = last_line2.decode('utf-8').rstrip('\r\n') password = last_line2.decode('utf-8').rstrip('\r\n')
assert not password is None assert not password is None
clipboard_set(password)
try:
clipboard_set(password)
get_time = lambda : datetime.datetime.now().timestamp() get_time = lambda : datetime.datetime.now().timestamp()
start = get_time() start = get_time()
while True: while True:
@ -1563,6 +1564,8 @@ def pass_ssh_osx(argv):
else: else:
print('\r%5.2fs remains' % remains, end='') print('\r%5.2fs remains' % remains, end='')
time.sleep(0.1) time.sleep(0.1)
except KeyboardInterrupt:
pass
clipboard_set('') clipboard_set('')
print('\rcleared cliboard\n', end='') print('\rcleared cliboard\n', end='')