$size doesnt need to be global
This commit is contained in:
parent
a3e59697a1
commit
e5ba15949b
18
docs/faq.rst
18
docs/faq.rst
@ -47,22 +47,12 @@ terminfo files to the server::
|
||||
kitty +kitten ssh myserver
|
||||
|
||||
This ssh kitten takes all the same command line arguments
|
||||
as ssh, you can alias it to ssh in your shell's rc files to avoid having to
|
||||
type it each time::
|
||||
as ssh, you can alias it to something small in your shell's rc files to avoid
|
||||
having to type it each time::
|
||||
|
||||
alias ssh="kitty +kitten ssh"
|
||||
alias s="kitty +kitten ssh"
|
||||
|
||||
Remember to also setup :ref:`shell_integration` for completion and other
|
||||
niceties.
|
||||
|
||||
If for some reason that does not work (typically because the server is using a
|
||||
non POSIX compliant shell as ``/bin/sh``), you can try using it with ``python``
|
||||
instead::
|
||||
|
||||
kitty +kitten ssh use-python myserver
|
||||
|
||||
If that also fails, perhaps because python is not installed on the remote
|
||||
server, use the following one-liner instead (it
|
||||
If the ssh kitten fails, use the following one-liner instead (it
|
||||
is slower as it needs to ssh into the server twice, but will work with most
|
||||
servers)::
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ def make_tarfile(ssh_opts: SSHOptions, base_env: Dict[str, str]) -> bytes:
|
||||
return ans
|
||||
|
||||
def filter_files(tarinfo: tarfile.TarInfo) -> Optional[tarfile.TarInfo]:
|
||||
if tarinfo.name.endswith('ssh/bootstrap.sh') or tarinfo.name.endswith('ssh/bootstrap.py'):
|
||||
if tarinfo.name.endswith('ssh/bootstrap.sh'):
|
||||
return None
|
||||
return normalize_tarinfo(tarinfo)
|
||||
|
||||
@ -324,16 +324,10 @@ def get_posix_cmd(remote_args: List[str]) -> List[str]:
|
||||
return [f'sh -c {shlex.quote(sh_script)}']
|
||||
|
||||
|
||||
def get_python_cmd(remote_args: List[str]) -> List[str]:
|
||||
raise NotImplementedError('TODO: Implement me')
|
||||
|
||||
|
||||
def main(args: List[str]) -> NoReturn:
|
||||
args = args[1:]
|
||||
use_posix = True
|
||||
if args and args[0] == 'use-python':
|
||||
args = args[1:]
|
||||
use_posix = False
|
||||
args = args[1:] # backwards compat from when we had a python implementation
|
||||
try:
|
||||
ssh_args, server_args, passthrough = parse_ssh_args(args)
|
||||
except InvalidSSHArgs as e:
|
||||
@ -347,7 +341,7 @@ def main(args: List[str]) -> NoReturn:
|
||||
cmd.append('-t')
|
||||
cmd.append('--')
|
||||
cmd.append(hostname)
|
||||
f = get_posix_cmd if use_posix else get_python_cmd
|
||||
f = get_posix_cmd
|
||||
cmd += f(remote_args)
|
||||
os.execvp('ssh', cmd)
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@ data_complete="n"
|
||||
leading_data=""
|
||||
|
||||
dsc_to_kitty "ssh" "hostname=$hostname:pwfile=$password_filename:pw=$data_password"
|
||||
size=""
|
||||
record_separator=$(printf "\036")
|
||||
|
||||
untar_and_read_env() {
|
||||
@ -47,7 +46,7 @@ untar_and_read_env() {
|
||||
# using dd with bs=1 is very slow, so use head. On non GNU coreutils head
|
||||
# does not limit itself to reading -c bytes only from the pipe so we can potentially lose
|
||||
# some trailing data, for instance if the user starts typing. Cant be helped.
|
||||
command head -c "$size" < /dev/tty | command base64 -d | command tar xjf - --no-same-owner -C "$tdir";
|
||||
command head -c "$1" < /dev/tty | command base64 -d | command tar xjf - --no-same-owner -C "$tdir";
|
||||
data_file="$tdir/kitty-ssh-kitten-data.sh";
|
||||
[ -f "$data_file" ] && . "$data_file";
|
||||
data_dir="$HOME/$KITTY_SSH_KITTEN_DATA_DIR"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user