Skip to content

Commit

Permalink
Revert "Change the way to call the core in the speed test"
Browse files Browse the repository at this point in the history
This reverts commit dd85ccd.
  • Loading branch information
2dust committed Jan 9, 2023
1 parent 75f63af commit 4909a55
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions v2rayN/v2rayN/Handler/CoreHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,15 @@ private int CoreStartViaString(string configStr)
string fileName = CoreFindexe(coreInfo);
if (fileName == "") return -1;

var pathTemp = Utils.GetConfigPath($"temp_{Utils.GetGUID(false)}.json");
File.WriteAllText(pathTemp, configStr);
if (!File.Exists(pathTemp))
{
return -1;
}

Process p = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = fileName,
Arguments = $"-config \"{pathTemp}\"",
Arguments = "-config stdin:",
WorkingDirectory = Utils.GetConfigPath(),
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true,
Expand All @@ -261,16 +255,15 @@ private int CoreStartViaString(string configStr)
p.Start();
p.BeginOutputReadLine();

p.StandardInput.Write(configStr);
p.StandardInput.Close();

if (p.WaitForExit(1000))
{
throw new Exception(p.StandardError.ReadToEnd());
}

Global.processJob.AddProcess(p.Handle);

Thread.Sleep(1000);
File.Delete(pathTemp);

return p.Id;
}
catch (Exception ex)
Expand Down

0 comments on commit 4909a55

Please sign in to comment.