Improve tun mode log
This commit is contained in:
@@ -200,6 +200,7 @@ namespace v2rayN.Base
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var showWindow = _config.tunModeItem.showWindow;
|
||||||
Process p = new Process
|
Process p = new Process
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
@@ -207,8 +208,9 @@ namespace v2rayN.Base
|
|||||||
FileName = fileName,
|
FileName = fileName,
|
||||||
Arguments = $"run -c {Utils.GetConfigPath(_tunConfigName)}",
|
Arguments = $"run -c {Utils.GetConfigPath(_tunConfigName)}",
|
||||||
WorkingDirectory = Utils.GetConfigPath(),
|
WorkingDirectory = Utils.GetConfigPath(),
|
||||||
UseShellExecute = _config.tunModeItem.showWindow,
|
UseShellExecute = showWindow,
|
||||||
CreateNoWindow = !_config.tunModeItem.showWindow,
|
CreateNoWindow = !showWindow,
|
||||||
|
RedirectStandardError = !showWindow,
|
||||||
Verb = "runas",
|
Verb = "runas",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -216,9 +218,16 @@ namespace v2rayN.Base
|
|||||||
_process = p;
|
_process = p;
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
if (p.WaitForExit(1000))
|
if (p.WaitForExit(1000))
|
||||||
|
{
|
||||||
|
if (showWindow)
|
||||||
{
|
{
|
||||||
throw new Exception("start tun mode fail");
|
throw new Exception("start tun mode fail");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception(p.StandardError.ReadToEnd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Global.processJob.AddProcess(p.Handle);
|
Global.processJob.AddProcess(p.Handle);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user