Exemplo n.º 1
0
        public virtual IProcess StartProcess(ToolSettings toolSettings, ProcessSettings processSettings = null)
        {
            var toolPath              = toolSettings.ToolPath;
            var arguments             = toolSettings.GetArguments();
            var argumentsForExecution = arguments.RenderForExecution();
            var argumentsForOutput    = arguments.RenderForOutput();

#if NETCORE
            if (EnvironmentInfo.IsUnix && toolPath.EndsWithOrdinalIgnoreCase("exe"))
            {
                argumentsForExecution = $"{toolPath.DoubleQuoteIfNeeded()} {argumentsForExecution}";
                argumentsForOutput    = $"{toolPath.DoubleQuoteIfNeeded()} {argumentsForOutput}";
                toolPath = "/usr/bin/mono";
            }
#endif

            ControlFlow.Assert(toolPath != null, "ToolPath was not set.");
            ControlFlow.Assert(File.Exists(toolPath), $"ToolPath '{toolPath}' does not exist.");
            Logger.Info($"> {Path.GetFullPath(toolPath).DoubleQuoteIfNeeded()} {argumentsForOutput}");

            processSettings = processSettings ?? new ProcessSettings();
            return(StartProcessInternal(
                       toolPath,
                       argumentsForExecution,
                       toolSettings.WorkingDirectory,
                       processSettings.EnvironmentVariables,
                       processSettings.ExecutionTimeout,
                       processSettings.RedirectOutput,
                       arguments.Filter));
        }
Exemplo n.º 2
0
        public override IProcess StartProcess(ToolSettings toolSettings, ProcessSettings processSettings = null)
        {
            var toolPath  = toolSettings.ToolPath;
            var arguments = toolSettings.GetArguments();

            ControlFlow.Assert(toolPath != null, "ToolPath was not set.");
            ControlFlow.Assert(File.Exists(toolPath), $"ToolPath '{toolPath}' does not exist.");

            processSettings = processSettings ?? new ProcessSettings();
            return(StartProcess(
                       toolPath,
                       arguments.RenderForExecution(),
                       toolSettings.WorkingDirectory,
                       processSettings.EnvironmentVariables,
                       processSettings.ExecutionTimeout,
                       processSettings.RedirectOutput,
                       processSettings.RedirectOutput ? new Func <string, string>(arguments.Filter) : null));
        }
Exemplo n.º 3
0
        public virtual IProcess StartProcess(ToolSettings toolSettings, ProcessSettings processSettings = null)
        {
            var toolPath  = toolSettings.ToolPath;
            var arguments = toolSettings.GetArguments();

            ControlFlow.Assert(toolPath != null, "ToolPath was not set.");
            ControlFlow.Assert(File.Exists(toolPath), $"ToolPath '{toolPath}' does not exist.");
            Logger.Info($"> {Path.GetFullPath(toolPath).DoubleQuoteIfNeeded()} {arguments.RenderForOutput()}");

            processSettings = processSettings ?? new ProcessSettings();
            return(StartProcessInternal(
                       toolPath,
                       arguments.RenderForExecution(),
                       toolSettings.WorkingDirectory,
                       processSettings.EnvironmentVariables,
                       processSettings.ExecutionTimeout,
                       processSettings.RedirectOutput,
                       processSettings.RedirectOutput ? new Func <string, string>(arguments.Filter) : null));
        }