Update the client to redirect Tor output.

This commit is contained in:
2024-03-06 20:38:54 -05:00
parent 9adb9146ea
commit e151295f31
2 changed files with 8 additions and 0 deletions

View File

@@ -323,11 +323,13 @@ namespace Tor
psi.CreateNoWindow = true; psi.CreateNoWindow = true;
psi.UseShellExecute = false; psi.UseShellExecute = false;
psi.WindowStyle = ProcessWindowStyle.Hidden; psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.RedirectStandardOutput = true;
psi.WorkingDirectory = Path.GetDirectoryName(createParams.Path); psi.WorkingDirectory = Path.GetDirectoryName(createParams.Path);
try try
{ {
process = new Process(); process = new Process();
process.OutputDataReceived += OutputDataReceived;
process.EnableRaisingEvents = true; process.EnableRaisingEvents = true;
process.Exited += new EventHandler(OnHandleProcessExited); process.Exited += new EventHandler(OnHandleProcessExited);
process.StartInfo = psi; process.StartInfo = psi;
@@ -339,6 +341,7 @@ namespace Tor
throw new TorException("The tor application process failed to launch"); throw new TorException("The tor application process failed to launch");
} }
process.BeginOutputReadLine();
} }
catch (Exception exception) catch (Exception exception)
{ {
@@ -367,6 +370,11 @@ namespace Tor
}); });
} }
} }
private void OutputDataReceived(object sender, DataReceivedEventArgs e)
{
Console.WriteLine(e.Data);
}
/// <summary> /// <summary>
/// Shuts down the tor application process and releases the associated components of the class. /// Shuts down the tor application process and releases the associated components of the class.

Binary file not shown.