Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update lang versions and address warnings #648

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion SimpleExec/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public static void Run(
.Create(
Resolve(Validate(name)),
args,
#if NET8_0_OR_GREATER
[],
#else
Enumerable.Empty<string>(),
#endif
workingDirectory,
false,
configureEnvironment ?? defaultAction,
Expand Down Expand Up @@ -172,7 +176,11 @@ public static Task RunAsync(
.Create(
Resolve(Validate(name)),
args,
#if NET8_0_OR_GREATER
[],
#else
Enumerable.Empty<string>(),
#endif
workingDirectory,
false,
configureEnvironment ?? defaultAction,
Expand Down Expand Up @@ -288,7 +296,11 @@ private static async Task RunAsync(
.Create(
Resolve(Validate(name)),
args,
#if NET8_0_OR_GREATER
[],
#else
Enumerable.Empty<string>(),
#endif
workingDirectory,
true,
configureEnvironment ?? defaultAction,
Expand Down Expand Up @@ -434,7 +446,7 @@ private static string Resolve(string name)
#if NET8_0_OR_GREATER
: [name];
#else
: new List<string> { name, };
: new List<string> { name, };
#endif

var path = GetSearchDirectories().SelectMany(_ => searchFileNames, Path.Combine)
Expand Down
4 changes: 0 additions & 4 deletions SimpleExecTester/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ public static int Main(string[] args)
if (args.Contains("unicode"))
{
Console.OutputEncoding = Encoding.Unicode;
#if NET8_0_OR_GREATER
args = [.. args, "Pi (\u03a0)"];
#else
args = args.Append("Pi (\u03a0)").ToArray();
#endif
}

Console.Out.WriteLine($"Arg count: {args.Length}");
Expand Down
1 change: 1 addition & 0 deletions SimpleExecTester/SimpleExecTester.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<LangVersion>default</LangVersion>
<OutputType>Exe</OutputType>
<RollForward>major</RollForward>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
Expand Down
2 changes: 1 addition & 1 deletion SimpleExecTests/EchoingCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void EchoingACommandWithAnArgList()
Console.SetOut(Capture.Out);

// act
Command.Run("dotnet", new[] { "exec", Tester.Path, "he llo", "\"world \"today\"", });
Command.Run("dotnet", ["exec", Tester.Path, "he llo", "\"world \"today\"",]);

// assert
var lines = Capture.Out.ToString()!.Split('\r', '\n').ToList();
Expand Down
1 change: 1 addition & 0 deletions SimpleExecTests/SimpleExecTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>default</LangVersion>
<RollForward>major</RollForward>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
</PropertyGroup>
Expand Down