mirror of https://github.com/2dust/v2rayN
bug fixes
parent
ea3a9cc70e
commit
c3e00ba31b
|
@ -173,6 +173,7 @@ namespace v2rayN.Handler
|
||||||
string fileName = CoreFindexe(_coreInfo);
|
string fileName = CoreFindexe(_coreInfo);
|
||||||
if (fileName == "") return;
|
if (fileName == "") return;
|
||||||
|
|
||||||
|
var displayLog = node.configType == EConfigType.Custom ? node.displayLog : true;
|
||||||
Process p = new Process
|
Process p = new Process
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
|
@ -181,14 +182,14 @@ namespace v2rayN.Handler
|
||||||
Arguments = _coreInfo.arguments,
|
Arguments = _coreInfo.arguments,
|
||||||
WorkingDirectory = Utils.GetConfigPath(),
|
WorkingDirectory = Utils.GetConfigPath(),
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
RedirectStandardOutput = node.displayLog,
|
RedirectStandardOutput = displayLog,
|
||||||
RedirectStandardError = node.displayLog,
|
RedirectStandardError = displayLog,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
StandardOutputEncoding = node.displayLog ? Encoding.UTF8 : null,
|
StandardOutputEncoding = displayLog ? Encoding.UTF8 : null,
|
||||||
StandardErrorEncoding = node.displayLog ? Encoding.UTF8 : null,
|
StandardErrorEncoding = displayLog ? Encoding.UTF8 : null,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (node.displayLog)
|
if (displayLog)
|
||||||
{
|
{
|
||||||
p.OutputDataReceived += (sender, e) =>
|
p.OutputDataReceived += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
@ -200,7 +201,7 @@ namespace v2rayN.Handler
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
p.Start();
|
p.Start();
|
||||||
if (node.displayLog)
|
if (displayLog)
|
||||||
{
|
{
|
||||||
p.BeginOutputReadLine();
|
p.BeginOutputReadLine();
|
||||||
}
|
}
|
||||||
|
@ -208,7 +209,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
if (p.WaitForExit(1000))
|
if (p.WaitForExit(1000))
|
||||||
{
|
{
|
||||||
throw new Exception(node.displayLog ? p.StandardError.ReadToEnd() : "启动进程失败并退出 (Failed to start the process and exited)");
|
throw new Exception(displayLog ? p.StandardError.ReadToEnd() : "启动进程失败并退出 (Failed to start the process and exited)");
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.processJob.AddProcess(p.Handle);
|
Global.processJob.AddProcess(p.Handle);
|
||||||
|
|
Loading…
Reference in New Issue