[~] 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):
|
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,18 +1551,21 @@ 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)
|
|
||||||
|
|
||||||
get_time = lambda : datetime.datetime.now().timestamp()
|
try:
|
||||||
start = get_time()
|
clipboard_set(password)
|
||||||
while True:
|
get_time = lambda : datetime.datetime.now().timestamp()
|
||||||
cur = get_time()
|
start = get_time()
|
||||||
remains = 10 - (cur - start)
|
while True:
|
||||||
if remains <= 1e-8:
|
cur = get_time()
|
||||||
break
|
remains = 10 - (cur - start)
|
||||||
else:
|
if remains <= 1e-8:
|
||||||
print('\r%5.2fs remains' % remains, end='')
|
break
|
||||||
time.sleep(0.1)
|
else:
|
||||||
|
print('\r%5.2fs remains' % remains, end='')
|
||||||
|
time.sleep(0.1)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
clipboard_set('')
|
clipboard_set('')
|
||||||
print('\rcleared cliboard\n', end='')
|
print('\rcleared cliboard\n', end='')
|
||||||
|
Loading…
Reference in New Issue
Block a user