mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-14 04:24:52 +02:00
Make using kitty askpass optional
This commit is contained in:
@@ -23,13 +23,24 @@ HOME = os.path.expanduser('~')
|
||||
login_shell = pwd.getpwuid(os.geteuid()).pw_shell or 'sh'
|
||||
|
||||
|
||||
def set_echo(fd, on=False):
|
||||
if fd < 0:
|
||||
fd = sys.stdin.fileno()
|
||||
old = termios.tcgetattr(fd)
|
||||
new = termios.tcgetattr(fd)
|
||||
if on:
|
||||
new[3] |= termios.ECHO
|
||||
else:
|
||||
new[3] &= ~termios.ECHO
|
||||
termios.tcsetattr(fd, termios.TCSANOW, new)
|
||||
return fd, old
|
||||
|
||||
|
||||
def cleanup():
|
||||
global tty_fd
|
||||
if tty_fd > -1:
|
||||
if echo_on:
|
||||
s = termios.tcgetattr(tty_fd)
|
||||
s[3] |= termios.ECHO
|
||||
termios.tcsetattr(tty_fd, termios.TCSANOW, s)
|
||||
set_echo(tty_fd, True)
|
||||
os.close(tty_fd)
|
||||
tty_fd = -1
|
||||
|
||||
@@ -218,6 +229,7 @@ def main():
|
||||
tty_fd = os.open(os.ctermid(), os.O_RDWR | getattr(os, 'O_CLOEXEC', 16777216))
|
||||
try:
|
||||
if request_data:
|
||||
set_echo(tty_fd, on=False)
|
||||
send_data_request()
|
||||
get_data()
|
||||
finally:
|
||||
|
||||
@@ -73,7 +73,10 @@ login_cwd=""
|
||||
|
||||
request_data="REQUEST_DATA"
|
||||
trap "cleanup_on_bootstrap_exit" EXIT
|
||||
[ "$request_data" = "1" ] && dcs_to_kitty "ssh" "id="REQUEST_ID":pwfile="PASSWORD_FILENAME":pw="DATA_PASSWORD""
|
||||
[ "$request_data" = "1" ] && {
|
||||
command stty "-echo" < /dev/tty
|
||||
dcs_to_kitty "ssh" "id="REQUEST_ID":pwfile="PASSWORD_FILENAME":pw="DATA_PASSWORD""
|
||||
}
|
||||
|
||||
mv_files_and_dirs() {
|
||||
cwd="$PWD"
|
||||
|
||||
Reference in New Issue
Block a user