-
Notifications
You must be signed in to change notification settings - Fork 155
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
The handle is invalid #680
Comments
In the second block of code, it looks to me like it is doing the right thing, assuming that the next output after what is shown here is a prompt of some kind, without a newline at the end. You are calling As for the first error you saw, that appears to be a bug in asyncio on Windows. There's a reference to _empty_waiter in _ProactorBasePipeTransport._force_close, but _empty_waiter is only set in _ProactorBaseWritePipeTransport and _ProactorDatagramTransport and not in _ProactorReadPipeTransport. The assignment of _empty_waiter to |
Thanks for your swift response. print(await SSHClientProcess.stdout.read(1),end='') or print(await SSHClientProcess.stdout.readexactly(1),end='') it will get stuck too. |
Yes - both read() and readexactly() will eventually block as well. The only difference is that you should see the prompt get output with those, where you wouldn't see the prompt get output in the readline() case. Since the remote system is waiting for input after that, you can't just keep reading. You need to provide some input or write EOF on stdin if you want to see any more output. |
if it works well,It should output |
On some remote systems, trying to write the input before the prompt comes up won't work. That input gets thrown away by the remote system, since it wasn't actively reading input at the time. I don't know if that's the case here or not, but if you write the input before seeing the prompt, that may be the source of the problem. If you know what the prompt looks like, you can use If you're not seeing the prompt even after switching to |
Sorry,I don't find a method like |
The Are you trying to mix process redirection (assigning the If you are doing manual I/O, you should be doing stdin.write() on the process, but that will only work if you don't already have stdin redirected to something else (like sys.stdin). As for why things might not be working interactively using the redirects, are you requesting a PTY on the SSH session? If not, trying to send data from a terminal might not work well. For instance, you may have issues like needing to type Ctrl-J instead of Enter to end a line. You can request a PTY by passing in the |
Python 3.11.9 or 3.9.18
asyncssh 2.14.1
windowns11 os build 26120.1350
when I run
it will be
and when I run
It will get stuck at
I really have no idea.
The text was updated successfully, but these errors were encountered: