Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctrl-C退出整个tssh #110

Open
SadSock opened this issue Apr 28, 2024 · 12 comments
Open

Ctrl-C退出整个tssh #110

SadSock opened this issue Apr 28, 2024 · 12 comments

Comments

@SadSock
Copy link

SadSock commented Apr 28, 2024

在win上,mintty内用tssh连接远程的Linux服务器,当按下Ctrl-C组合键时,tssh整个直接退出了。

使用ssh时,只会中断远程Linux服务器当前运行的程序。

tssh的这个行为是符合预期的吗?有什么办法只是终止Linux服务器上的程序?

@lonnywong
Copy link
Member

不符合预期。只是 mintty 这样?安装的是 Windows 版 tssh 吗?

@SadSock
Copy link
Author

SadSock commented Apr 29, 2024

对,Windows terminal就不是这样。问题可能出在哪里?

@lonnywong
Copy link
Member

在你按下 ctrl + c 时,可能 mintty 直接杀了 tssh 进程,并没有将 ctrl + c 事件转发给 tssh 进程处理。

ctrl + c 默认是让进程退出,但是进程可以注册自己来处理 ctrl + c 事件。不知 mintty 为什么不遵守这个规则。

你试试加 .exetssh.exe 运行,看看会不会按 Windows 的方式来处理。

@SadSock
Copy link
Author

SadSock commented Apr 29, 2024

在你按下 ctrl + c 时,可能 mintty 直接杀了 tssh 进程,并没有将 ctrl + c 事件转发给 tssh 进程处理。

ctrl + c 默认是让进程退出,但是进程可以注册自己来处理 ctrl + c 事件。不知 mintty 为什么不遵守这个规则。

你试试加 .exetssh.exe 运行,看看会不会按 Windows 的方式来处理。

我就是用tssh.exe来运行的

@lonnywong
Copy link
Member

你可以试试 winpty tssh 怎么样,可能需要手工安装 winpty。

@SadSock
Copy link
Author

SadSock commented Apr 30, 2024

你可以试试 winpty tssh 怎么样,可能需要手工安装 winpty。

我是在断网的环境下用的,winpty可以支持在断网的环境吗?

@lonnywong
Copy link
Member

应该支持的吧,只要你能连通你的服务器就行。

@lonnywong
Copy link
Member

@SadSock 你的 mintty 是怎么安装的?我安装了 Cygwin 之后,里面默认有个 mintty,先打开 cygwin ,在 cygwin 中运行 mintty,再在 mintty 中运行 tssh xxx 登录 Linux 服务器,Ctrl + C 并不会退出。

@SadSock
Copy link
Author

SadSock commented May 29, 2024

@SadSock 你的 mintty 是怎么安装的?我安装了 Cygwin 之后,里面默认有个 mintty,先打开 cygwin ,在 cygwin 中运行 mintty,再在 mintty 中运行 tssh xxx 登录 Linux 服务器,Ctrl + C 并不会退出。

我的是装git自带的

@lonnywong
Copy link
Member

我的是装git自带的

git bash ?

  • git bash 中运行 mintty -V,当显示 3.6.1Ctrl + C 是有问题的,当显示 3.6.4Ctrl + C 是没问题的:

    $ mintty -V
    mintty 3.6.1 (x86_64-pc-msys)
    © 2022 Thomas Wolff, Andy Koppe
    License GPLv3+: GNU GPL version 3 or later
    There is no warranty, to the extent permitted by law.
    
    $ mintty -V
    mintty 3.6.4 (x86_64-pc-msys)
    © 2023 Thomas Wolff, Andy Koppe
    License GPLv3+: GNU GPL version 3 or later
    There is no warranty, to the extent permitted by law.
    
  • 我也不知为什么我的电脑会有两上不同的版本:
    image

  • git bash 中运行 mintty,会弹出下面的对话框,我随便选了第一个:
    git bash mintty

  • mintty 中运行 which tssh,我是通过 scoop install tssh 安装的 tssh

    $ which tssh
    /c/Users/lonny/scoop/shims/tssh
    
  • mintty 中运行 tssh -v,是当前的最新版本:

    $ tssh -v
    trzsz ssh 0.1.19
    
  • mintty 中登录 Linux 服务器,然后按 Ctrl + C

    $ tssh u22
    (ins)lonny@UbuntuVM:~$ ^C
    (ins)lonny@UbuntuVM:~$ ^C
    (ins)lonny@UbuntuVM:~$ ^C
    (ins)lonny@UbuntuVM:~$
    

@SadSock
Copy link
Author

SadSock commented May 30, 2024

  • mintty -V

这样啊,我看了一下,我的是显示的是3.6.3,我升级一下试试。

@SadSock
Copy link
Author

SadSock commented Jun 5, 2024

换了新版本的mintty就好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants