2019-02-10 03:27
浏览 261

进入crypto / ssh包,stdoutpipe()io.Reader的缓冲区限制是多少

I'm writing a utility to execute commands on remote servers with the crypto/ssh package. I'm currently reading from the session.stdoutpipe() io.Reader in to a bytes.Buffer which I can format and print out after the session is complete.

The documentation states:

StdoutPipe func() (io.Reader, error) StdoutPipe returns a pipe that will be connected to the remote command's standard output when the command starts. There is a fixed amount of buffering that is shared between stdout and stderr streams. If the StdoutPipe reader is not serviced fast enough it may eventually cause the remote command to block.

I haven't had any issues so far with my testing, but it got me curious to know what is the fixed amount. I've successfully streamed text up to 6.5mb without reading the pipe Reader until the command has finished.

Does anyone know what the fixed amount is, or when the command will start to block? I can't find it in the source.

图片转代码服务由CSDN问答提供 功能建议

我正在编写一个实用程序,以使用crypto / ssh软件包在远程服务器上执行命令。 我目前正在从session.stdoutpipe()io.Reader中读取一个bytes.Buffer,我可以在会话完成后对其进行格式化和打印。 </ p>

文档说明:</ p>

StdoutPipe func()(io.Reader,错误) StdoutPipe返回一个管道,该管道将 命令启动时将其连接到远程命令的标准输出。 在stdout和stderr流之间共享固定数量的缓冲</ strong>。 如果StdoutPipe阅读器的维修速度不够快,则最终可能导致远程命令被阻止。</ p> </ blockquote>

到目前为止,我的测试没有任何问题,但是 我很想知道固定金额是多少。 在命令完成之前,我已经成功读取了6.5mb的文本,而没有读取Pipe Reader。 </ p>

有人知道固定金额是多少,或者什么时候该命令将开始阻塞? 我在源代码中找不到它。</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题