Example #1
0
 /// <summary>
 /// Runs a command.
 /// </summary>
 /// <param name="command">The command to run.</param>
 /// <param name="exePath">The path of the executable to run.</param>
 /// <returns>Standard output, freshly captured from the executable.</returns>
 public static string RunCommand(ToolCommand command, string exePath)
 {
     if (command.Command == "run")
     {
         string stdout, stderr;
         int    exitCode = RunExe(exePath, command.Argument, out stdout, out stderr);
         if (exitCode != 0)
         {
             throw new Exception($"Executable at '{exePath}' exited with a nonzero exit code: {stdout}{stderr}");
         }
         if (command.HasExpectedOutput)
         {
             Assert.AreEqual(command.ExpectedOutput, stdout.Trim());
         }
         return(stdout);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Example #2
0
 /// <summary>
 /// Runs a command.
 /// </summary>
 /// <param name="command">The command to run.</param>
 /// <param name="exePath">The path of the executable to run.</param>
 /// <returns>Standard output, freshly captured from the executable.</returns>
 public static string RunCommand(ToolCommand command, string exePath)
 {
     return(RunCommand(command, exePath, true));
 }