Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Contrib SSH : can't import on Windows due to posix pipe use

未关闭 适合新手
#1,154 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
cli, networking

调研方向

从 contrib/ssh/server.py 开始,检查其管道输入是如何导入和初始化的。让 SSH 服务器选择适合平台的管道输入,使异步 SSHD 设置能够在 Windows 上工作,同时保持 POSIX 行为,然后验证两个导入路径以及 Windows 初始化。

由索引模型根据 Issue 内容生成。

描述

I have set up an async SSHD on my Windows 10 box and I had to patch contrib/ssh/server.py in order to do it. The problem is that we import prompt_toolkit.input.posix_pipe at the top, when we need to be versatile to platform and import prompt_toolkit.input.win32_pipe on Windows platforms instead.

Here's how I'm handling this locally:

--- a/prompt_toolkit/contrib/ssh/server.py      2020-05-29 13:15:17.950284900 -0700
+++ b/prompt_toolkit/contrib/ssh/server.py      2020-05-29 13:27:21.302283000 -0700
@@ -9,7 +9,14 @@

 from prompt_toolkit.application.current import AppSession, create_app_session
 from prompt_toolkit.data_structures import Size
-from prompt_toolkit.input.posix_pipe import PosixPipeInput
+from importlib import import_module
+from prompt_toolkit.utils import is_windows
+if (is_windows()):
+    pipe_module = import_module('prompt_toolkit.input.win32_pipe')
+    pipe_input  = pipe_module.Win32PipeInput
+else:
+    pipe_module = import_module('prompt_toolkit.input.posix_pipe')
+    pipe_input  = pipe_module.PosixPipeInput
 from prompt_toolkit.output.vt100 import Vt100_Output

 __all__ = [
@@ -27,7 +34,7 @@
         # PipInput object, for sending input in the CLI.
         # (This is something that we can use in the prompt_toolkit event loop,
         # but still write date in manually.)
-        self._input = PosixPipeInput()
+        self._input = pipe_input()

         # Output object. Don't render to the real stdout, but write everything
         # in the SSH channel.
主要语言
Python
星标
10.6k
派生
819
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

prompt-toolkit/python-prompt-toolkit 的其他 Issue

查看 prompt-toolkit/python-prompt-toolkit 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。