【发布时间】:2010-07-28 14:25:32
【问题描述】:
这就是我正在做的:
ssh_ = new Process();
ssh_.StartInfo.FileName = SshProvider;
ssh_.StartInfo.Arguments = "-t -t " + Environment.UserName + "@" + serverName_;
ssh_.StartInfo.UseShellExecute = false;
ssh_.StartInfo.RedirectStandardInput = true;
ssh_.StartInfo.RedirectStandardOutput = true;
ssh_.StartInfo.RedirectStandardError = true;
ssh_.StartInfo.CreateNoWindow = true;
ssh_.Start();
new Thread(new ThreadStart(ReadStdOut)).Start();
new Thread(new ThreadStart(ReadStdErr)).Start();
我想从标准输出(或标准错误)读取密码提示并将密码写入标准输入,但 ssh 正在从我启动单声道应用程序的控制台写入和读取。我不明白为什么会这样,因为我已经在上面的代码中重定向了这些流。
【问题讨论】: