[~] Refactort
This commit is contained in:
parent
f9f18df737
commit
9620bb2b25
@ -132,8 +132,8 @@ def intercept_output(
|
||||
not (isinstance(last_data, bytes) and len(last_data) == 0):
|
||||
t3 = current_subprocess.stdout.peek()
|
||||
|
||||
t4 = current_subprocess.stdout.read(len(t3))
|
||||
assert isinstance(t4, int)
|
||||
t4: bytes = current_subprocess.stdout.read(len(t3))
|
||||
assert isinstance(t4, bytes)
|
||||
|
||||
last_data = t3
|
||||
output.append(t3)
|
||||
@ -1551,18 +1551,21 @@ def pass_ssh_osx(argv):
|
||||
password = last_line2.decode('utf-8').rstrip('\r\n')
|
||||
assert not password is None
|
||||
|
||||
clipboard_set(password)
|
||||
|
||||
get_time = lambda : datetime.datetime.now().timestamp()
|
||||
start = get_time()
|
||||
while True:
|
||||
cur = get_time()
|
||||
remains = 10 - (cur - start)
|
||||
if remains <= 1e-8:
|
||||
break
|
||||
else:
|
||||
print('\r%5.2fs remains' % remains, end='')
|
||||
time.sleep(0.1)
|
||||
try:
|
||||
clipboard_set(password)
|
||||
get_time = lambda : datetime.datetime.now().timestamp()
|
||||
start = get_time()
|
||||
while True:
|
||||
cur = get_time()
|
||||
remains = 10 - (cur - start)
|
||||
if remains <= 1e-8:
|
||||
break
|
||||
else:
|
||||
print('\r%5.2fs remains' % remains, end='')
|
||||
time.sleep(0.1)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
clipboard_set('')
|
||||
print('\rcleared cliboard\n', end='')
|
||||
|
Loading…
Reference in New Issue
Block a user