RedirectStandardError
RedirectStandardOutput
ProcessStartInfo
app.run(host="0.0.0.0", port=8080)
waitress
wsgiserver
static Process ExecuteCommand(string name, string file, string args) { var processInfo = new ProcessStartInfo(file, args); processInfo.CreateNoWindow = true; processInfo.UseShellExecute = false; processInfo.RedirectStandardError = true; processInfo.RedirectStandardOutput = true; var process = Process.Start(processInfo); process.OutputDataReceived += (object sender, DataReceivedEventArgs e) => LogOutput(name, e.Data,false); process.BeginOutputReadLine(); process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => LogOutput(name, e.Data, true); process.BeginErrorReadLine(); return process; } private static void LogOutput(string name, string data, bool isError) { Console.WriteLine(string.Format("at {0:d/M/yyyy H\\:m\\:s} {1}:{2}{3}",DateTime.Now, name, (isError ? "(error) " : ""), data)); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)