Skip to content

Commit

Permalink
Add global override to show process command-line
Browse files Browse the repository at this point in the history
  • Loading branch information
gitfool committed Feb 22, 2019
1 parent 5e8e454 commit 6a4a3d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Cake.Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class Settings
public const string SkipVerification = "Settings_SkipVerification";
public const string SkipPackageVersionCheck = "Settings_SkipPackageVersionCheck";
public const string NoMonoCoersion = "Settings_NoMonoCoersion";
public const string ShowProcessCommandLine = "Settings_ShowProcessCommandLine";
}

public static class Paths
Expand Down
12 changes: 9 additions & 3 deletions src/Cake.Core/IO/ProcessRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public sealed class ProcessRunner : IProcessRunner
private readonly IToolLocator _tools;
private readonly ICakeConfiguration _configuration;
private readonly bool _noMonoCoersion;
private readonly bool _showCommandLine;

/// <summary>
/// Initializes a new instance of the <see cref="ProcessRunner" /> class.
Expand All @@ -42,6 +43,8 @@ public ProcessRunner(IFileSystem fileSystem, ICakeEnvironment environment, ICake

var noMonoCoersion = configuration.GetValue(Constants.Settings.NoMonoCoersion);
_noMonoCoersion = noMonoCoersion != null && noMonoCoersion.Equals("true", StringComparison.OrdinalIgnoreCase);
var showCommandLine = configuration.GetValue(Constants.Settings.ShowProcessCommandLine);
_showCommandLine = showCommandLine != null && showCommandLine.Equals("true", StringComparison.OrdinalIgnoreCase);
}

/// <summary>
Expand Down Expand Up @@ -123,9 +126,12 @@ internal ProcessStartInfo GetProcessStartInfo(FilePath filePath, ProcessSettings

if (!settings.Silent)
{
// Log the filename and arguments.
var message = string.Concat(fileName, " ", arguments.RenderSafe().TrimEnd());
_log.Verbose(Verbosity.Diagnostic, "Executing: {0}", message);
using (_log.WithVerbosity(_showCommandLine ? Verbosity.Diagnostic : _log.Verbosity))
{
// Log the filename and arguments.
var message = string.Concat(fileName, " ", arguments.RenderSafe().TrimEnd());
_log.Verbose(Verbosity.Diagnostic, "Executing: {0}", message);
}
}

// Create the process start info.
Expand Down

0 comments on commit 6a4a3d4

Please sign in to comment.