Skip to content

Commit

Permalink
Merge pull request #648 from adamralph/lang-versions-warnings
Browse files Browse the repository at this point in the history
update lang versions and address warnings
  • Loading branch information
adamralph authored Jul 21, 2024
2 parents 07b8497 + e5945d6 commit 5af2017
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
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

0 comments on commit 5af2017

Please sign in to comment.