Skip to content

Commit

Permalink
Update NuGet packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Nov 21, 2023
1 parent ed0093f commit 4b43ca3
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 73 deletions.
8 changes: 4 additions & 4 deletions CliWrap.Benchmarks/BufferingBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public class BufferingBenchmarks
[Benchmark]
public async Task<(string, string)> ProcessX()
{
var (_, stdOutStream, stdErrStream) = Cysharp.Diagnostics.ProcessX.GetDualAsyncEnumerable(
FilePath,
arguments: Args
);
var (_, stdOutStream, stdErrStream) = Cysharp
.Diagnostics
.ProcessX
.GetDualAsyncEnumerable(FilePath, arguments: Args);

var stdOutTask = stdOutStream.ToTask();
var stdErrTask = stdErrStream.ToTask();
Expand Down
4 changes: 2 additions & 2 deletions CliWrap.Benchmarks/CliWrap.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.7" />
<PackageReference Include="CSharpier.MsBuild" Version="0.25.0" PrivateAssets="all" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.2" PrivateAssets="all" />
<PackageReference Include="ProcessX" Version="1.5.5" />
<PackageReference Include="RunProcessAsTask" Version="1.2.4" />
<PackageReference Include="MedallionShell" Version="1.6.2" />
Expand Down
8 changes: 4 additions & 4 deletions CliWrap.Benchmarks/PullEventStreamBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public async Task<int> ProcessX()
{
var counter = 0;

var (_, stdOutStream, stdErrStream) = Cysharp.Diagnostics.ProcessX.GetDualAsyncEnumerable(
FilePath,
arguments: Args
);
var (_, stdOutStream, stdErrStream) = Cysharp
.Diagnostics
.ProcessX
.GetDualAsyncEnumerable(FilePath, arguments: Args);

var consumeStdOutTask = Task.Run(async () =>
{
Expand Down
15 changes: 15 additions & 0 deletions CliWrap.Magic/Contexts/EnvironmentVariablesContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections.Generic;
using Contextual;

namespace CliWrap.Magic.Contexts;

internal class EnvironmentVariablesContext : Context
{
public IReadOnlyDictionary<string, string?> Variables { get; }

public EnvironmentVariablesContext(IReadOnlyDictionary<string, string?> variables) =>
Variables = variables;

public EnvironmentVariablesContext()
: this(new Dictionary<string, string?>()) { }
}
2 changes: 1 addition & 1 deletion CliWrap.Signaler/CliWrap.Signaler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" Version="0.25.0" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.2" PrivateAssets="all" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions CliWrap.Tests.Dummy/CliWrap.Tests.Dummy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CliFx" Version="2.3.4" />
<PackageReference Include="CSharpier.MsBuild" Version="0.25.0" PrivateAssets="all" />
<PackageReference Include="PolyShim" Version="1.7.0" PrivateAssets="all" />
<PackageReference Include="CliFx" Version="2.3.5" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.2" PrivateAssets="all" />
<PackageReference Include="PolyShim" Version="1.8.0" PrivateAssets="all" />
<PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>

Expand Down
14 changes: 7 additions & 7 deletions CliWrap.Tests/CliWrap.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.25.0" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="PolyShim" Version="1.7.0" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.2" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="PolyShim" Version="1.8.0" PrivateAssets="all" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" PrivateAssets="all" />
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
</ItemGroup>

Expand Down
15 changes: 10 additions & 5 deletions CliWrap.Tests/ConfigurationSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public void I_can_configure_the_command_line_arguments_using_a_builder()
// Assert
original.Should().BeEquivalentTo(modified, o => o.Excluding(c => c.Arguments));
original.Arguments.Should().NotBe(modified.Arguments);
modified.Arguments
modified
.Arguments
.Should()
.Be("-a \"foo bar\" \"\\\"foo\\\\bar\\\"\" 3.14 foo bar -5 89.13");
}
Expand Down Expand Up @@ -125,7 +126,8 @@ public void I_can_configure_the_user_credentials()
// Assert
original.Should().BeEquivalentTo(modified, o => o.Excluding(c => c.Credentials));
original.Credentials.Should().NotBe(modified.Credentials);
modified.Credentials
modified
.Credentials
.Should()
.BeEquivalentTo(new Credentials("domain", "username", "password", true));
}
Expand All @@ -148,7 +150,8 @@ public void I_can_configure_the_user_credentials_using_a_builder()
// Assert
original.Should().BeEquivalentTo(modified, o => o.Excluding(c => c.Credentials));
original.Credentials.Should().NotBe(modified.Credentials);
modified.Credentials
modified
.Credentials
.Should()
.BeEquivalentTo(new Credentials("domain", "username", "password", true));
}
Expand All @@ -167,7 +170,8 @@ public void I_can_configure_the_environment_variables()
// Assert
original.Should().BeEquivalentTo(modified, o => o.Excluding(c => c.EnvironmentVariables));
original.EnvironmentVariables.Should().NotBeEquivalentTo(modified.EnvironmentVariables);
modified.EnvironmentVariables
modified
.EnvironmentVariables
.Should()
.BeEquivalentTo(
new Dictionary<string, string?> { ["name"] = "value", ["key"] = "door" }
Expand All @@ -191,7 +195,8 @@ public void I_can_configure_the_environment_variables_using_a_builder()
// Assert
original.Should().BeEquivalentTo(modified, o => o.Excluding(c => c.EnvironmentVariables));
original.EnvironmentVariables.Should().NotBeEquivalentTo(modified.EnvironmentVariables);
modified.EnvironmentVariables
modified
.EnvironmentVariables
.Should()
.BeEquivalentTo(
new Dictionary<string, string?>
Expand Down
6 changes: 4 additions & 2 deletions CliWrap.Tests/EnvironmentSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ public async Task I_can_execute_a_command_with_some_environment_variables_overwr
var result = await cmd.ExecuteBufferedAsync();

// Assert
result.StandardOutput
result
.StandardOutput
.Trim()
.Should()
.ContainAll($"[{variableToKeep}] = keep", $"[{variableToOverwrite}] = overwritten");

result.StandardOutput
result
.StandardOutput
.Trim()
.Should()
.NotContainAny(
Expand Down
7 changes: 3 additions & 4 deletions CliWrap.Tests/PipingSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,9 @@ public async Task I_can_execute_a_command_with_buffering_and_also_pipe_the_stdou
delegateLines
.Should()
.Equal(
result.StandardOutput.Split(
Environment.NewLine,
StringSplitOptions.RemoveEmptyEntries
)
result
.StandardOutput
.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries)
);
}

Expand Down
16 changes: 5 additions & 11 deletions CliWrap/CliWrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@
</PropertyGroup>

<PropertyGroup>
<Authors>$(Company)</Authors>
<Description>Library for interacting with external command-line interfaces</Description>
<PackageTags>shell pipe command line executable interface wrapper standard input output error arguments net core</PackageTags>
<PackageProjectUrl>https://github.com/Tyrrrz/CliWrap</PackageProjectUrl>
<PackageReleaseNotes>https://github.com/Tyrrrz/CliWrap/blob/master/Changelog.md</PackageReleaseNotes>
<PackageIcon>favicon.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Expand All @@ -27,12 +21,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" Version="0.25.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net462'" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
<PackageReference Include="PolyShim" Version="1.7.0" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="PolyShim" Version="1.8.0" PrivateAssets="all" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net462'" />
<PackageReference Include="System.Management" Version="7.0.2" Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1'" />
<PackageReference Include="System.Management" Version="8.0.0" Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1'" />
<PackageReference Include="System.Memory" Version="4.5.5" Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net462'" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" Condition="'$(TargetFramework)' == 'net462'" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion CliWrap/CommandTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public ConfiguredTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedCo
public partial class CommandTask<TResult>
{
/// <summary>
/// Casts the command task into a regular task.
/// Converts the command task into a regular task.
/// </summary>
public static implicit operator Task<TResult>(CommandTask<TResult> commandTask) =>
commandTask.Task;
Expand Down
20 changes: 11 additions & 9 deletions CliWrap/EventStream/PullEventStreamCommandExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@ await channel
yield return new StartedCommandEvent(commandTask.ProcessId);

// Close the channel once the command completes, so that ReceiveAsync() can finish
_ = commandTask.Task.ContinueWith(
async _ =>
// ReSharper disable once AccessToDisposedClosure
await channel
.ReportCompletionAsync(forcefulCancellationToken)
.ConfigureAwait(false),
// Run the continuation even if the parent task failed
TaskContinuationOptions.None
);
_ = commandTask
.Task
.ContinueWith(
async _ =>
// ReSharper disable once AccessToDisposedClosure
await channel
.ReportCompletionAsync(forcefulCancellationToken)
.ConfigureAwait(false),
// Run the continuation even if the parent task failed
TaskContinuationOptions.None
);

await foreach (
var cmdEvent in channel.ReceiveAsync(forcefulCancellationToken).ConfigureAwait(false)
Expand Down
40 changes: 21 additions & 19 deletions CliWrap/EventStream/PushEventStreamCommandExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,28 @@ CancellationToken gracefulCancellationToken
// Don't pass cancellation token to the continuation because we need it to
// trigger regardless of how the task completed.
_ = commandTask.Task.ContinueWith(
t =>
{
// Canceled tasks don't have exceptions
if (t.IsCanceled)
_ = commandTask
.Task
.ContinueWith(
t =>
{
observer.OnError(new TaskCanceledException(t));
}
else if (t.Exception is not null)
{
observer.OnError(t.Exception.TryGetSingle() ?? t.Exception);
}
else
{
observer.OnNext(new ExitedCommandEvent(t.Result.ExitCode));
observer.OnCompleted();
}
},
TaskContinuationOptions.None
);
// Canceled tasks don't have exceptions
if (t.IsCanceled)
{
observer.OnError(new TaskCanceledException(t));
}
else if (t.Exception is not null)
{
observer.OnError(t.Exception.TryGetSingle() ?? t.Exception);
}
else
{
observer.OnNext(new ExitedCommandEvent(t.Result.ExitCode));
observer.OnCompleted();
}
},
TaskContinuationOptions.None
);
return Disposable.Null;
});
Expand Down
3 changes: 2 additions & 1 deletion CliWrap/Utils/SimplexStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ CancellationToken cancellationToken

var length = Math.Min(count, _sharedBufferBytes - _sharedBufferBytesRead);

_sharedBuffer.Memory
_sharedBuffer
.Memory
.Slice(_sharedBufferBytesRead, length)
.CopyTo(buffer.AsMemory(offset, length));

Expand Down
9 changes: 9 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@
<Nullable>annotations</Nullable>
</PropertyGroup>

<PropertyGroup>
<Authors>$(Company)</Authors>
<Description>Library for interacting with external command-line interfaces</Description>
<PackageTags>yshell pipe command line executable interface wrapper standard input output error arguments net core</PackageTags>
<PackageProjectUrl>https://github.com/Tyrrrz/CliWrap</PackageProjectUrl>
<PackageReleaseNotes>https://github.com/Tyrrrz/CliWrap/blob/master/Changelog.md</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

</Project>

0 comments on commit 4b43ca3

Please sign in to comment.