背景
我正在编写一个 Web 应用程序,这样我就可以从一个网站控制一个Ubuntu 服务器。
我的一个想法是从单声道运行“屏幕”应用程序并从那里重定向我的输入和输出。
从单声道运行“屏幕”:
ProcessStartInfo info = new ProcessStartInfo("screen", "-m");
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
info.RedirectStandardInput = true;
var p = new Process();
p.StartInfo = info;
p.Start();
var output = p.StandardOutput;
var input = p.StandardInput;
但是使用 RedirectStandardInput 运行“屏幕”会出现错误:
Must be connected to a terminal
我尝试了许多不同的参数,但似乎没有一个适用于“重定向标准输入”
控制服务器的其他想法将不胜感激