< Summary - pva.SuperV

Information
Class: pva.Helpers.SystemCommand
Assembly: pva.Helpers
File(s): /home/runner/work/pva.SuperV/pva.SuperV/pva.Helpers/SystemCommand.cs
Tag: dotnet-ubuntu_22190969454
Line coverage
87%
Covered lines: 28
Uncovered lines: 4
Coverable lines: 32
Total lines: 42
Line coverage: 87.5%
Branch coverage
83%
Covered branches: 5
Total branches: 6
Branch coverage: 83.3%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Run(...)83.33%6687.5%

File(s)

/home/runner/work/pva.SuperV/pva.SuperV/pva.Helpers/SystemCommand.cs

#LineLine coverage
 1using System.Diagnostics;
 2
 3namespace pva.Helpers
 4{
 5    public static class SystemCommand
 6    {
 7        public static void Run(string command, string args, out string output, out string error, string? directory = nul
 368        {
 369            string actualCommand = String.Empty;
 3610            string arguments = command;
 3611            if (OperatingSystem.IsWindows())
 012            {
 013                actualCommand = "cmd.exe";
 014                arguments = $"/c {command} {args}";
 015            }
 3616            else if (OperatingSystem.IsLinux())
 3617            {
 3618                actualCommand = command;
 3619                arguments = args;
 3620            }
 3621            using Process process = new()
 3622            {
 3623                StartInfo = new ProcessStartInfo
 3624                {
 3625                    FileName = actualCommand,
 3626                    UseShellExecute = false,
 3627                    RedirectStandardOutput = true,
 3628                    RedirectStandardError = true,
 3629                    RedirectStandardInput = true,
 3630                    Arguments = arguments,
 3631                    CreateNoWindow = true,
 3632                    WorkingDirectory = directory ?? string.Empty,
 3633                }
 3634            };
 3635            process.Start();
 3636            process.WaitForExit();
 3637            output = process.StandardOutput.ReadToEnd();
 3638            error = process.StandardError.ReadToEnd();
 7239        }
 40    }
 41
 42}