base: fixed error handling for the distancebetween context

This commit is contained in:
alterNERDtive 2020-10-24 16:28:24 +02:00
parent cd9437c59d
commit 006bbcac3b
2 changed files with 7 additions and 6 deletions

View file

@ -60,22 +60,23 @@ namespace alterNERDtive
string errorMessage = "";
p.Start();
string output = p.StandardOutput.ReadToEnd();
string stdout = p.StandardOutput.ReadToEnd();
string stderr = p.StandardError.ReadToEnd();
p.WaitForExit();
switch (p.ExitCode)
{
case 0:
distance = decimal.Parse(output);
distance = decimal.Parse(stdout);
break;
case 1:
case 2:
error = true;
Log.Error(output);
errorMessage = output;
Log.Error(stderr);
errorMessage = stderr;
break;
default:
error = true;
Log.Error(output);
Log.Error(stderr);
errorMessage = "Unrecoverable error in plugin.";
break;

View file

@ -19,7 +19,7 @@ namespace alterNERDtive.util
p.StartInfo.Arguments = arguments;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.RedirectStandardOutput = true;
//p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
return p;