Skip to content

Commit

Permalink
Set a default MDOP (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
vcsjones authored May 12, 2024
2 parents 061517c + 92e467a commit 64b8ec3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/AzureSignTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal sealed class SignCommand : Command
internal bool NoPageHashing { get; set; }
internal bool ContinueOnError { get; set; }
internal string? InputFileList { get; set; }
internal int? MaxDegreeOfParallelism { get; set; }
internal int MaxDegreeOfParallelism { get; set; } = 4;
internal bool Colors { get; set; }
internal bool SkipSignedFiles { get; set; }
internal bool AppendSignature { get; set; }
Expand Down Expand Up @@ -266,9 +266,9 @@ private async ValueTask<int> RunSign()
logger.LogInformation("Cancelling signing operations.");
};
var options = new ParallelOptions();
if (MaxDegreeOfParallelism.HasValue)
if (MaxDegreeOfParallelism != 0)
{
options.MaxDegreeOfParallelism = MaxDegreeOfParallelism.Value;
options.MaxDegreeOfParallelism = MaxDegreeOfParallelism;
}
logger.LogTrace("Creating context");

Expand Down Expand Up @@ -453,9 +453,9 @@ private bool ValidateArguments(CommandRunContext context)
valid &= ValidateHashAlgorithm(context, FileDigestAlgorithm, "--file-digest");
valid &= ValidateHashAlgorithm(context, TimestampDigestAlgorithm, "--timestamp-digest");

if (MaxDegreeOfParallelism is < -1 or 0)
if (MaxDegreeOfParallelism < -1)
{
context.Error.WriteLine("'--max-degree-of-parallelism' must be a positive interger, or negative one.");
context.Error.WriteLine("'--max-degree-of-parallelism' must be a positive interger, zero, or -1.");
valid = false;
}

Expand Down

0 comments on commit 64b8ec3

Please sign in to comment.