0

a c# app is called by another c# app and it exits out throwing exit code

Environment.Exit(1);

how would the calling c# app capture this exit code?

myProcess.StartInfo.UseShellExecute = false;
            myProcess.StartInfo.FileName = "cmd.exe";
            myProcess.StartInfo.Arguments = "/C " + process_name + s;

            myProcess.StartInfo.CreateNoWindow = true;
            myProcess.StartInfo.RedirectStandardOutput = true;
            myProcess.StartInfo.RedirectStandardError = true;
            myProcess.Start();
John Ryann
  • 2,283
  • 11
  • 43
  • 60

1 Answers1

0

Any reason you can't use Process.ExitCode?

Erik Philips
  • 53,428
  • 11
  • 128
  • 150